You are now following this question
- You will see updates in your followed content feed.
- You may receive emails, depending on your communication preferences.
Image color segmentation to find different objects of a candle
2 views (last 30 days)
Show older comments
Hi, everybody. I am working on image processing of candle to find the length of the candle, flame and wick(Thread between candle and flame). Using gray scale image,In lab view, the parts of candle and flame are recognized but unable to find the length of the wick. For this I need to use color segmentation (math script)to recognize each part in the image. Could anyone suggest me a method for the above. Thanks in advance.
1 Comment
Mmmm
on 29 Nov 2013
Can you please send me the part of your code where you are detecting flame. I am working on my school project and I am new in the MATLAB world so I am a little bit lost. I guess you can help me with this issue.
Accepted Answer
Image Analyst
on 3 Jan 2013
37 Comments
saam anand
on 3 Jan 2013
Thanks for your reply. I am looking for Image color segmentation in mat lab. Thank you.
Image Analyst
on 3 Jan 2013
I give several color segmentation demos in my File Exchange. If you want more specific advice, you'll have to upload an image.
saam anand
on 3 Jan 2013
Hi, thanks for your reply. The above link shows the input image. for this image I need to segment the candle, flame and wick (thread between flame and candle) After segmentation the image should show three different parts. .
please suggest me a method. Thanks in advance.
Image Analyst
on 3 Jan 2013
Why do you need to do this? What real world use does it have? Or is it your homework problem or semester project?
saam anand
on 3 Jan 2013
Hi this is a part of my thesis work. I have worked on it, I was able to detect the edges of flame and candle but couldn't segment the wick. my task is to find the length of the candle, flame and wick as well. But I was not able to find the length of the wick. thank you.
Image Analyst
on 3 Jan 2013
Since the wick is black and the background is black you can only find the lower end of the wick if it's on the candle. So find the candle, find its convex hull, look inside of that, threshold to find black, and look at the lowest part (largest row number). Finding the top part could be tougher. For this image you can find the flame and the candle and mask them out of the image. Then look at what's left and find the brightest part, assuming it's glowing. Then calculate the distance between the part on the candle and the part in the air. Since it's your graduate thesis I can't do much for you. Is it part of your Master's or Ph.D.? What is the main overall topic of your research that this is a small part of?
saam anand
on 3 Jan 2013
Thank you. I will try with you suggestion. It's a part of my masters thesis work.
saam anand
on 5 Jan 2013
The above method gives the length of the wick. But here i am using this in real time where I need to segment all the three objects. Finally I need to measure different parameters while the candle melts.The above link contains an image which was taken by using usb camera. In this image we can see the wick(Thread between candle and flame). I cannot detect the edges clearly. I have used all the filters but wasn't able to detect the edges of the three objects.could you please help me how to segment this.
Image Analyst
on 5 Jan 2013
blogger.com won't let me see it unless I sign up for (create) a blog myself, which I don't want to do. It's not possible to find the area of the wick because it's black and your background is black. You'll have to be satisfied with the length. You can get the area of the flame and candle by traditional techniques (thresholding, color segmentation), but for the candle you'll probably want to take the convex hull and fill it in, but fill in just the part near the wick only, say, say limiting your fill area to just the top 20or 30 lines of the candle.
saam anand
on 5 Jan 2013
Hi can you please tell me how to upload an image directly without using blogger.
saam anand
on 5 Jan 2013
Here I am explaining my whole project clearly. I need to create a setup for a candle and measure various parameters during the melting process until it melts completely. I have created a VI in lab view which gives the parameters when an image is read. But that VI is working only for gray scale images and color segmentation can't be done. I need to segment the three objects and then I can call this M-file to lab view. Hope you understand my problem.
Image Analyst
on 5 Jan 2013
I'd suggest changing the background from black to a vastly different color than anything else in the scene. Then it will be a lot easier.
saam anand
on 5 Jan 2013
will it be a good idea to idea to use back light illumination, i.e. applying LED source from the background. so that the image might look more clear. please let me know your opinion.
Image Analyst
on 5 Jan 2013
No, I was thinking more like cyan or blue. Look at my avatar above and to the left, or here to pick a color that is as opposite to red, orange, and yellow as you can get.
saam anand
on 7 Jan 2013
Hi, the above link shows an example image with blue back ground.I need to do color segmentation to find the length of the wick. can you please suggest a method. If it works then i can take an image from real world and test it. thank you.
Image Analyst
on 7 Jan 2013
That's no better - that's just a pseudocolored grayscale image. You need to put a paper with a different color behind the candle.
saam anand
on 7 Jan 2013
Hi, the above link shows an image of a candle with light green(paper) background. can you suggest a method to segment.
Image Analyst
on 7 Jan 2013
Yes! Much, much better. Simply extract all three color channels:
% Extract the individual red, green, and blue color channels.
redChannel = rgbImage(:, :, 1);
greenChannel = rgbImage(:, :, 2);
blueChannel = rgbImage(:, :, 3);
Find where all three channels are dark
thresholdValue = 20; % Whatever...
wick = (redChannel < thresholdValue) & ...
greenChannel < thresholdValue) & ...
blueChannel < thresholdValue);
saam anand
on 7 Jan 2013
Hi, thank you. I have tried with the above code. I can see the wick. sorry for confusing you. I need to segment the input image as 3 parts, i.e, candle, wick and flame. If I can segment this the length and other parameters of the three segmented parts can be taken through VI in lab view.
Image Analyst
on 7 Jan 2013
Edited: Image Analyst
on 7 Jan 2013
Same process. Just figure out what the thresholds need to be for each color channel. You might want to use a different color space if RGB is not working well for you, like HSV. See my File Exchange for demonstrations. By the way, you still haven't said what the larger topic of your thesis is that this is a small part of. What else are you working on? Because I know this is such a trivial task it can't be an entire thesis.
saam anand
on 7 Jan 2013
I have created an environment to measure atmospheric temperature, sterain temparature,pressure through a PCB and in lab view all the parameters as I mentioned above. the total experiment is to give the better parameters for a candle with improved characteristics. this task may be extended further. Anyway thank you for your suggestion, I will try with that.
saam anand
on 9 Jan 2013
Hi, I was trying to segment three parts using HSV model by using hsv model by varying the thresholds of hue, saturation and value. could you please tell me the threshold values of black and white colors.
Image Analyst
on 9 Jan 2013
Black should have valueImage < 20 (or whatever). White should have valueImage > 200 (or whatever) and satImage < 20 (or whatever).
saam anand
on 9 Jan 2013
could you please say how to use the values. While using HSV i need to specify thresholds for Hue, saturation and value for each color. I am sorry IF i confused you.
Image Analyst
on 9 Jan 2013
Did I not say how to use values? Like
blackWickPixels = valueImage < 20; % or whatever value works.
candlePixels = valueImage>200 & saturationImage< 20;
Yes you have confused me. If you don't mean like the above, then what do you mean when you ask how you are supposed to use the values?
saam anand
on 12 Jan 2013
I am sorry. finally i got the desired result. credit goes to you and thank you.
saam anand
on 22 Jan 2013
Edited: saam anand
on 22 Jan 2013
Hi when I am reading the whole output segmented image into lab view, I am getting an error. for this I need to convert the output image to 2D(dimensional) array in matlab. From this array I can achieve the desired output. could you please help me with this. Thank you.
Image Analyst
on 22 Jan 2013
Just have a uint8 image where background pixels = 0, candle pixels = 1, wick pixels = 2, and flame pixels = 3. Write it out with imwrite().
saam anand
on 7 Feb 2013
Edited: saam anand
on 7 Feb 2013
Hi, when the above segmentation is working for 1 image, but in real time, I am not able to achieve the segmentation. I need to take several images while the candle is burning down and every time I have to change the threshold values for each image.This is becoming complex and uneasy to distinguish the images. could you please help me with any logic that it detects candle length(white part) as one component and then it goes to flame and wick.Here I am attaching one of my real time images.
http://tinypic.com/r/2ymbw2q/6. Thanks In advance.
Image Analyst
on 7 Feb 2013
Sorry, but to make it more robust would take more time than I can devote to your project.
saam anand
on 7 Feb 2013
Edited: saam anand
on 8 Feb 2013
Thanks for your reply. please try to help me with this. I will try but don't have enough experience. I can wait for few days, If you can give me an idea it would help me more than anything. Thank you.
saam anand
on 11 Feb 2013
Hi can you please suggest a method that detect and find the length of length of the candle and then wick and flame. Thank you.
Image Analyst
on 11 Feb 2013
This is how you gain experience. I simply don't have enough time to devote to making your project robust enough to handle all kinds of different images. That takes time. You get it working for some images, then another image comes along and it fails. Then you have to tweak the algorithm. It could take days or weeks. Sorry, but I can't do that for you.
tamanna
on 17 Feb 2013
hey..can u plz tel me how u segment the flame part?? actually i am working on an image in which i required to segment the convex part in an image..please help me out if u can
Image Analyst
on 17 Feb 2013
I presume this is directed to saam, who probably has this completed by now.
More Answers (0)
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!An Error Occurred
Unable to complete the action because of changes made to the page. Reload the page to see its updated state.
Select a Web Site
Choose a web site 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 web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)