이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
i am doing image processing for red tomato detection.how can I do complete the fruit image and remove unwanted objects in background??
조회 수: 7 (최근 30일)
이전 댓글 표시
i am unable to get good result. i am getting this result.see attach image. i want to remove these unwanted objects in background and need full image of tomato. kindly help me in this regard. i am attaching result image here.kindly help me soon. thanks
댓글 수: 2
Walter Roberson
2018년 2월 16일
The original image would help.
Question for you: is Ruby Grapefruit a red fruit? How about Blood Orange? Is peach a red fruit (at least some varieties?).
Darn it looks like this phone interface does not allow me to upload pictures, or I would attach a picture of some of the apples that grow on my tree for a decision as to whether they are red fruit or not.
By the way, are you aware that in the United States, tomato is legally classified as a vegetable and specifically not as a fruit? This had to do with a tax ruling because at the time fruit was subject to a tax that vegetables were not subject to.
Muhammad Hammad Malik
2018년 2월 17일
this is the original image.i am doing red tomato detection. i do not idea about american classification, as i know tomato is known as fruit. so kindly help me in red tomato detection.how i can remove this background and make it complete tomato.thanks
채택된 답변
Image Analyst
2018년 2월 17일
편집: Image Analyst
2018년 2월 17일
See my demo: https://www.mathworks.com/matlabcentral/fileexchange/26420-simplecolordetection Or use the Color Thresholder app on the Apps tab of the tool ribbon.
댓글 수: 26
Muhammad Hammad Malik
2018년 2월 17일
thanks. i will try to understand and follow this then let you know is if i face any problem.thanks
Image Analyst
2018년 2월 17일
편집: Image Analyst
2018년 2월 17일
Thank you. I've reproduced the error and am fixing it. It might have something to do with the new version. I haven't run it for a long time -- last time with some ancient version of MATLAB. There is now (with R2017b) an incompatibility with stem() and with the logo creating code. I've fixed those and am attaching the fixed code here.
Muhammad Hammad Malik
2018년 2월 18일
thanks. now it is working. but even still i am unable to get good result.result is same like i above mention.
Image Analyst
2018년 2월 18일
You might look at the Color Thresholder on the Apps tab of the MATLAB tool ribbon. You might look at that, or my other demos in my File Exchange, where segmentation is done in a different color space.
Muhammad Hammad Malik
2018년 3월 30일
kindly tell me that how you choose values for H,S,V thresholds in your demo?
Muhammad Hammad Malik
2018년 3월 31일
편집: Walter Roberson
2018년 3월 31일
thanks.i do not know too much about programming. so please help me. how you calculate these values using histogram and i make this code to detect red fruit. is it right or wrong what do you think?
%Assign the low and high thresholds
hueThresholdLow = 0.17;
hueThresholdHigh = graythresh(hImage);
saturationThresholdLow = graythresh(sImage);
saturationThresholdHigh = 0.45;
valueThresholdLow = graythresh(vImage);
valueThresholdHigh = 0.67;
% Now apply each color band's particular thresholds to the color band
hueMask = (hImage = hueThresholdLow) & (hImage >= hueThresholdHigh);
saturationMask = (sImage <= saturationThresholdLow) & (sImage = saturationThresholdHigh);
valueMask = (vImage = valueThresholdLow) & (vImage >= valueThresholdHigh);
what do you think. guide about it please.
Muhammad Hammad Malik
2018년 4월 1일
편집: Image Analyst
2018년 4월 1일
What can the color thresholder do? I want to do red fruit detection using above mentioned programming not by using color thresholder. i randomly choosed these threshold values for red fruit detection, if someone ask that how you calculated these, then can i say that i selected these using color app, even i did not selected using color app just randomly selected?
Image Analyst
2018년 4월 1일
Rnadom selection of thresholds won't work. You need a methodical way to pick the hue, saturation, and value. I'd do it in HSV color space. That said, there is a bit of a judgment call in exactly when red stops being red. It's a gradual transition. It's not like you have reds and then suddenly a huge gap in hues and now you have yellows. It's gradual and there is no one, "right" answer. See the gamut below:
And it might vary picture by picture so you'll have to come up with some algorithm whereby you analyze the h, S, and V histograms and pick some thresholds. Or you can use fixed thresholds that don't vary by picture but if you do that you'll have to calibrate your image intensities - a whole different problem.
Muhammad Hammad Malik
2018년 4월 1일
i am not analyzing histogram.just using thresholding. as when i put my image in color thresholder in app tab then i move h,s,v where i can get maximum image. it has the same value which i am alrady using.is this right to do?thanks. see below image
Walter Roberson
2018년 4월 1일
No, that is not the right thing to do.
For the particular variant you show the image of, you probably need to concentrate your effort on deciding the boundary between orange (not ripe) and red (ripe). However... https://store.tomatofest.com/category_s/33.htm the following image is of a fully ripe tomato:
"Take 'Black Krim', a brownish Russian variety with "a very salty taste," Hilgenberg says. Like many dark varieties, it comes from the area around the Black Sea. 'Cherokee Purple' is a burgundy tomato with a sweet, complex flavor sometimes described as having smoky undertones. 'Cream Sausage' is a meaty, finger-shaped tomato that is a pale, buttermilk yellow. Imagine it in a fresh salsa with cilantro. 'Dr. Carolyn' starts ivory and turns yellow as it ripens. 'Paul Robeson' is nearly black. 'Green Zebra' is green striped with yellow."
Image Analyst
2018년 4월 1일
Muhammad, you ARE analyzing the histogram - just by looking at it. The histogram is that bar chart shown to the right of the image. It helps you visually decide WHERE to put the threshold value. As you can see from the hue histogram, there is no clear place where red stops. It just smoothly transitions to orange. So there is no "sensible" or "right" place to put the dividing line between red and orange. It's just whatever you say it is. I mean, who could ever claim that you're wrong? It's just a judgment call.
After you do the color segmentation, you can do further processing, for example use bwareafilt() or bwareaopen() to throw out blobs that are not the correct size or shape.
Muhammad Hammad Malik
2018년 4월 2일
편집: Walter Roberson
2018년 4월 2일
this is also your demo @image analyst. in this you did color detection by hue. here how you selected threshold values for red?
% Red.
% IMPORTANT NOTE FOR RED. Red spans hues both less than 0.1 and more than 0.8.
% We're only getting one range here so we will miss some of the red pixels - those with hue less than around 0.1.
% To properly get all reds, you'd have to get a hue mask that is the result of TWO threshold operations.
hueThresholdLow = 0.80;
hueThresholdHigh = 1;
saturationThresholdLow = 0.58;
saturationThresholdHigh = 1;
valueThresholdLow = 0.55;
valueThresholdHigh = 1.0;
Image Analyst
2018년 4월 2일
I selected them by looking at the histogram and guessing. Then tweaked the values until I got what I wanted.
Walter Roberson
2018년 4월 2일
The image that you posted above, in https://www.mathworks.com/matlabcentral/answers/382021-i-am-doing-image-processing-for-red-tomato-detection-how-can-i-do-complete-the-fruit-image-and-remo#comment_536266, the top-right tomato appears to be fully ripe. But the tomato to the left of it: is it ripe or does it need another half day to ripen? The one to the right of it below the top one: probably not ripe. But it is going to change color as it ripens. At exactly what point between the color of the top right tomato and the one below it is a tomato to be considered ripe?
Muhammad Hammad Malik
2018년 4월 3일
편집: Muhammad Hammad Malik
2018년 4월 3일
the one below tomato will not consider others are ok and ready to ripe. and how we can say that this tomato is 90% ripen and other is 80%?
Walter Roberson
2018년 4월 3일
The bottom tomato, which is green, is certainly not ripe.
In my opinion, the tomato in the middle right cannot be said to be ripe. The middle left appears to be slightly more ripe, but I would not consider it ripe either.
But if the question is "Should these tomatoes be picked?" then to answer I would need to know "Picked for what purpose" ? The top right tomato I would not hesitate to serve in a salad in a restaurant. The top left tomato would do fine for cooking, and in a restaurant might be good enough for a toasted tomato sandwich, but I do not know that it would be good enough for a salad in a restaurant the prided itself on ingredients -- but if it were early afternoon when I was looking then I might be happy to pluck it in the evening for a meal. The two other tomatoes that are orange I would not serve to anyone in that form -- not unless the recipe was specifically for unripe tomatoes, such as making a spicy tomato pickle or making some kinds of salsa. But if it were getting late in the year and there was a danger of frost, I would no doubt pick them and put them in a sunny place to further ripen. I would also seriously consider picking them for further ripening if I was having difficulty with animals or insects attacking the plants: they are ripe enough that they will make a decent food if picked and allowed to ripen further. The green one? If frost was being warned, I would cover that green one but leave it on the vine for another couple of days.
Muhammad Hammad Malik
2018년 4월 4일
편집: Muhammad Hammad Malik
2018년 4월 4일
thanks. i will pick up for selling purposes in market. some people wants completely ripe tomatoes and some want even half ripped or you can say green and red both. so i think if a tomato with 50% ripe, will be ok. but the question is that ow we can decide that one tomato is 90% ripe and other is 60% ripe? @Walter
Muhammad Hammad Malik
2018년 4월 4일
you selected threshold by looking at histogram and guessing, then can i also do this thing too? is it right way to do or not? @Image Analyst ?
Walter Roberson
2018년 4월 4일
"i will pick up for selling purposes in market"
For whose purposes? Is this like a farmer who is growing only one variety of tomato who wants to know which one to harvest to send to market, knowing that different buyers prefer different states of ripeness? Is this like a vendor in the market who is selling only one variety of tomato who wants to be able to provide a scanner that potential customers can point at a tomato and get back a ripeness reading so they can make a decision as to whether to buy it or not?
"you selected threshold by looking at histogram and guessing, then can i also do this thing too?"
No, not if you are creating a device which is being claimed to be able to meaningfully analyze tomatoes.
To be able to meaningfully analyze tomatoes, you need to first define what it means for a tomato to be ripe. Perhaps you can do that in terms of sugar concentrations; perhaps you can do it in terms of Ethylene emissions. Then you need a device that can non-destructively measure whatever property it is. You can then simultaneously photograph the subject tomato under conditions equivalent to what would be used in practice (remember to allow for both sunlight and overcast if the final device is to be used at an outdoor market). With readings and photographs in hand, you can then attempt to find a correlation between color in some colorspace and ripeness... for that variety. It is a reasonable hypothesis to suspect that you might be able to get within (for example) 15% by analyzing the pictures under good lighting, but you need to actually do the tests to determine that.
Alternately, you could suspect that industry has some method and you could google up some good keywords such as "industrial determination of ripeness of tomato" and see what you come up with.
Walter Roberson
2019년 11월 21일
Imran Y: Okay, go ahead and write the code you need.
I would, however, recommend to you that you first figure out how to know when a tomato is sufficiently ripe for your desired purpose, taking into account all of the different varieties of tomatoes that you will be dealing with.
it might not turn out to be strictly necessary to measure Ethylene emissions but read that link anyhow because it is relevant.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- 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)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)