help with image threshold using bioformats
Show older comments
Hi folks,
I am reading non-standard image files (not jpeg, png etc) into matlab, then using matlab to threshold these images based on RGB values.
However, all I've managed to do is to display the same image but in false colour...
Can you please help identify my error?
Thanks
data1 = bfopen(fullfile(sourcePathName, file1));
series1 = data1{1, 1};
series1_plane1 = series1{1, 1};
series1_plane2 = series1{2, 1};
series1_plane3 = series1{3, 1};
img1(:,:,1) = uint8(series1_plane1);
img1(:,:,2) = uint8(series1_plane2);
img1(:,:,3) = uint8(series1_plane3);
R = img1(:,:,1);
G = img1(:,:,2);
B = img1(:,:,3);
allR_Low = R>=148;
allR_High = R<=208;
allG_Low = G>=157;
allG_High = G<=255;
allB_Low = B>=193;
allB_High = B<=255;
allMask1 = img1;
allMask = allR_Low & allR_High & allG_Low & allG_High & allB_Low & allB_High;
allMask1(repmat(~allMask,[1 1 1])) = 0;
imshow(img1);
imshow(allMask1);


Accepted Answer
More Answers (0)
Categories
Find more on Red in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!