I want to detect both brown and whit colours,can anyone tell how to proceed plz
No products are associated with this question.
Direct link to this answer:
You find a lot of color detection questions in this forum. Please take the time to read, how to detect red and yellow colors, and make a transfer to brown and white.
Direct link to this comment:
Jan can u plz tell how to convert from red to brown plz,and even white
If you are interested in image processing, you should know different strategies to define a color. E.g. in the RGB color space "white" can be defined as "all(RGB > 250)" or another useful limit. You can work in HSV also - see e.g. http://en.wikipedia.org/wiki/HSL_and_HSV .
JAn an really interested in image processing thats why keep posting questions,plz can you tell for brown colour also ,it will be very useful to me ,please help
JAn the code fro yellow is
diff_im = imsubtract(data(:,:,1), rgb2gray(data));
%Use a median filter to filter out noise
diff_im = medfilt2(diff_im, [3 3]);
% Convert the resulting grayscale image into a binary image.
diff_im = im2bw(diff_im,0.18);
% Remove all those pixels less than 300px
diff_im = bwareaopen(diff_im,300);
% Label all the connected components in the image.
bw = bwlabel(diff_im, 8);
% Here we do the image blob analysis.
% We get a set of properties for each labeled region.
stats = regionprops(bw, 'BoundingBox', 'Centroid');
% Display the image
%This is a loop to bound the red objects in a rectangular box.
for object = 1:length(stats)
bb = stats(object).BoundingBox;
bc = stats(object).Centroid;
a=text(bc(1)+15,bc(2), strcat('X: ', num2str(round(bc(1))), '
G: ', num2str(round(bc(2)))));
set(a, 'FontName', 'Arial', 'FontWeight', 'bold', 'FontSize', 12, 'Color', 'green');
hold off,please tell in which line have to change for brown and white
In "diff_im = imsubtract(data(:,:,1), rgb2gray(data));" you subtract the grey value from the red component. Are you sure this concerns the color yellow?!
See my color detection examples:
I detect colors in three different ways.
I mean brown color MR.Analyst
Yes, I read that. Both brown and whit. I know. It should be easy to modify my apps, in fact the delta E app will work right out of the box. So how did it go? Do you have it working yet? By the way your code in your comment to Jan has nothing whatsoever to do with color segmentation, your comments notwithstanding. It just doesn't - I don't know why you think it should.
MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Opportunities for recent engineering grads.
New to MATLAB?
Choose your country to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a location from the following list:
See all countries