How can i detect the green region(meter display) & crop it out using matlab?

1 回表示 (過去 30 日間)
sufian ahmed
sufian ahmed 2017 年 7 月 15 日
コメント済み: Image Analyst 2020 年 6 月 8 日
I want to extract the green region(meter display).Here i attached a image which is digital electric meter. I want to extract only this region which contains meter reading value.if i only detect green region then other green region also detected.But i want to detect only the green region which contains meter reading.How can i do that in matlab ? sorry for asking question again. i cant explain it properly in my previous ques.
close all;
clear all;
clc;
Im = imread('2.jpg');
Im = imresize(Im, [512 512]);
diff_im = imsubtract(Im(:,:,2),rgb2gray(Im));
figure,imshow(diff_im);

採用された回答

Image Analyst
Image Analyst 2017 年 7 月 16 日
OK, it was so trivial and quick that I did it for you. See attached m-file, which produces this:
You can use imfill() if you want the black pixels inside.
  4 件のコメント
Shehzad Ali
Shehzad Ali 2020 年 6 月 8 日
編集済み: Shehzad Ali 2020 年 6 月 8 日
Sir I also use ur above code for same purpose but I can't handle color scheme in my dataset becuse in my dataset led colour is different. plz help me regarding this issue as soon as possible. thnx
my dataset sample is here.
Image Analyst
Image Analyst 2020 年 6 月 8 日
There are so many variables that we don't know about. Like the color - will it be the same for all images in your collection? And do they all have a dark rectangle that we can find to erase everything outside it? How bad could the reflections be? Could the display be rotated even more than that? Do all images have the same clutter outside the yellowish-green display? Or do the digits, letters, and graphics vary? Is the display always roughly in the center, or could it be anywhere? Are they all stamped with the blue graphics? You need to know all those things because they could make what is a very simple application (like cropping to known coordinates and doing ocr) to something much more complicated.

サインインしてコメントする。

その他の回答 (1 件)

Image Analyst
Image Analyst 2017 年 7 月 16 日
Try the Color Thresholder App on the Apps tab,
or see my color segmentation demos in My File Exchange,
or see the attached video that tracks green in a video.

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by