MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

# problem in detecting colour

Asked by nitisha singhal on 23 May 2013

hello everyone.... i m working on a project of detecting the colour of object in real time... basically a real time image processing is need to be done..... i want to take image using camera... then showing the image to operator.... then he will place the cursor at the place of which he want to know the colour.... then i want to display the name of that colour in notepad...... i thought i'l scale all the nearby colours in mainly red, green, blue, yellow, cyan, magenta, black and white..... i m totally new to image processing... i tried a lot... by reading in help i m able to read and show an image which is stored laptop. but neither i m able to work on the real time camera interfacing and then reading that pic.... nor i m able to get the rgb value of a particular pixel and then compare with my scaled values and nor in displying anyrhing in notpad..... i read a lot in all the questions poated here but as i m new to image processing i didn't get anything..... please help me.... this is my major project... and ur help is last hope for me....plzzzzzzzzz help in by providing solution to my problemmmm..... please provide me the code.

## Products

Answer by Chiranjit on 23 May 2013

Hi

this is an interesting project. I am willing to help you if u provide me some details.

Thanks Chiranjit chiranjitnemo at gmail.com

## 1 Comment

nitisha singhal on 26 May 2013

what details u need??????

Answer by Image Analyst on 26 May 2013

Just use ginput() and impixel() to get the value of the color where the user clicks. Then make up a list of all of the RGB values of your pre-defined list of standard reference colors. Then simply calculate the Euclidean distance between the chosen color and the standard list of colors. Use min() to pick out the one with the smallest distance - that will be the standard color closest to the user's chosen RGB color. There are other ways, like to convert to lab space and find the pair with the smallest Delta E, but since you're a beginner, it's easiest to do it in RGB color space. It's your project so you were supposed to (1) think up the algorithm and(2) code it up. Now that I've done (1) for you, at least try to do (2).