필터 지우기
필터 지우기

find a invoice slip on a package

조회 수: 1 (최근 30일)
Yash Verma
Yash Verma 2022년 5월 27일
댓글: David Willingham 2022년 6월 1일
Given :- A image of a package
Goal :- To localize the invoice slip on the package
Tried corner detection , thresholding , morphological operations but couldn't reach the desired output
Input :-
Desired Output :-
Scripts (Not giving desired output) :-
Unrecognized function or variable 'filename'.
I = imread("image");
I=im2gray(I);
level = graythresh(I);
BW = I>(level*max(I(:)));
BW=imfill(BW,'holes');
BW=bwareaopen(BW,1000);
se=strel('rectangle',[21 21]);
BW=imdilate(BW,se);
% BW = bwconvhull(BW);
CC = bwconncomp(BW);
numOfPixels = cellfun(@numel,CC.PixelIdxList);
[unused,indexOfMax] = max(numOfPixels);
BW(CC.PixelIdxList{indexOfMax}) = 0;
img=zeros([size(BW,1) size(BW,2)]);
img(CC.PixelIdxList{indexOfMax})=1;
stats = regionprops(img, 'BoundingBox');
crop_region = stats.BoundingBox; % contains [top_left_x top_left_y width height]
cropped_img = imcrop(I, crop_region);

답변 (1개)

David Willingham
David Willingham 2022년 5월 27일
If traditional image processing doesn't work, you could possible try to build an object detector based on Deep Learning.
The key to building an objector detector is to have enough labeled data to train the model. The Image Labeler app will help here, as you can upload all your images and label them efficiently.
  댓글 수: 2
Yash Verma
Yash Verma 2022년 5월 30일
We were thinking of going with YOLO is it a good option ?
David Willingham
David Willingham 2022년 6월 1일
Yolo is great but you have a few options. Here is a link to the pretrained models in MATLAB you can use as a starting point: https://github.com/matlab-deep-learning/MATLAB-Deep-Learning-Model-Hub#ObjectDetection

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by