Why do I get this error of the '=' operator? I am trying to get the individual mean values of the blobs of pixels (in the image there are blobs of pixels and I want each mean)
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Unsupported use of the '=' operator. To compare values for equality, use '=='. To pass name-value arguments using the name=value format, provide these arguments after all other inputs. Thank you SO much.
% Loads the z, 32 bit, single channel image
rgbImage = imread('test1.jpg');
grayImage = double(rgbImage(:, :, 2));
%replace each pixel with the average of its 3x3 neighbors with
%filtering with a radius of 2 pixels
mean3=conv2(grayImage,[0 1 0; 1 1 1; 0 1 0]/5,'same');
imshow(mean3, []);
%set a pixel threshold cutoff in imagej it was 60 - minimize background by choosing a
%value cutoff, such that every pixel less than that value is considered one class,
%while every pixel greater than that value is considered the other class.
roi = grayImage < 60; % Define roi by thresholding
%convert the intensity values of the background to "nothing"
%rather than to 0 and keeps the other values
%divide this image by itself -> ROI
roifinal = roi./roi;
imshow(roifinal, []);
%Prompt user to load raw image
I = imread('raw.tif');
I = double(I);
%multiply ROI by the raw image
FinalRegOI = roi .* roi;
%Resulting region of Interest
imshow(FinalRegOI, []);
%inc the brightness of the image
I1 = I+50;
figure(1); imshow()
% Tabulate individual mean values
info_table = table(meanOfPixelsInRoi = mean(grayImage(roi)), meanOfPixelsInRoi, 'VariableNames', {'FileName', 'Mean of pixel blobs'});
finalcount = sum(meanOfPixelsInRoi)
disp(info_table)
2 comentarios
Star Strider
el 31 de Jul. de 2022
I suggest instead:
filename = 'test1.jpg';
rgbImage = imread(filename);
. . .
meanOfPixelsInRoi = mean(grayImage(roi));
info_table = table(filename, meanOfPixelsInRoi, 'VariableNames', {'FileName', 'Mean of pixel blobs'});
or something similar.
I suspect that there may be other problems, so I am not posting this as an answer.
Respuestas (1)
Walter Roberson
el 31 de Jul. de 2022
info_table = table(meanOfPixelsInRoi = mean(grayImage(roi)), meanOfPixelsInRoi, 'VariableNames', {'FileName', 'Mean of pixel blobs'});
Until a couple of releases ago, that = in the middle of the table() call would have been strictly invalid syntax. I suspect that you are using one of those older versions.
In new enough versions, that call would be the equivalent of
table('meanOfPixelsInRoi', mean(grayImage(roi)), meanOfPixelsInRoi, 'VariableNames', {'FileName', 'Mean of pixel blobs'})
except possibly the = form would be invalid because there are positional parameters afterwards.
You cannot use = in the middle of a call to assign to a temporary variable. MATLAB is not C or C++. In C and C++ the result of an = is the rvalue and can be used in an expression, but assignment is syntactic in MATLAB and cannot be used inside expressions.
3 comentarios
Image Analyst
el 31 de Jul. de 2022
You'd need to do
table(meanOfPixelsInRoi, mean(grayImage(roi)), meanOfPixelsInRoi, ...
'VariableNames', {'MeanOfPixelBlobs1', 'MeanOfPixelBlobs2', 'MeanOfPixelBlobs3'})
but why are you making a table wth only one row in it and all 3 columns the same??? Why not save them all up and make a table with the values from all your images.
Ver también
Categorías
Más información sobre Geometric Transformation and Image Registration en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!