現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
i am doing image processing for red tomato detection.how can I do complete the fruit image and remove unwanted objects in background??
6 ビュー (過去 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.
Muhammad Hammad Malik
2018 年 4 月 2 日
then can i also do this thing too? is it right way to do or not?
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!エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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 (한국어)