HOW CAN I CREATE ROI IN IMAGE WITHOUT CROPPED IT FOR FEATURES DETECTION

2 ビュー (過去 30 日間)
messaoudi nada
messaoudi nada 2021 年 10 月 26 日
コメント済み: yanqi liu 2021 年 10 月 28 日
hellow everyone , i need help please! i want to extract SIFT features in region of intrerest for face so the first step is to create ROI in image and when i tried this code i got the binary image and the binarymask but i don't know how can i find the masked roi ! for features detection , i called regionprops but i don't know how i use it to get roi in my images without cropped it
THANKS IN ADVANCE !
ch=strcat('C:\Users\nada\Desktop\nadamastere\bd\fatigue\p1\image_',num2str(v,'%d'),'.png');
I1=imread(ch);
I1=imresize(I1,[row,colum]);
I1=rgb2gray(I1);
I1=im2double(I1);
I1=im2bw(I1);
figure(2);imshow(I1);
roI=imrect(gca,[20 20 110 120]);
bw=createMask(roI);
figure(3);imshow(bw);
props = regionprops(bw,'BoundingBox');
b =props(1).BoundingBox;

採用された回答

yanqi liu
yanqi liu 2021 年 10 月 27 日
ch=strcat('C:\Users\nada\Desktop\nadamastere\bd\fatigue\p1\image_',num2str(v,'%d'),'.png');
I1=imread(ch);
I1=imresize(I1,[row,colum]);
I1=rgb2gray(I1);
im = I1;
I1=im2double(I1);
I1=im2bw(I1);
figure(2);imshow(I1);
roI=imrect(gca,[20 20 110 120]);
bw=createMask(roI);
figure(3);imshow(bw);
props = regionprops(bw,'BoundingBox');
b =props(1).BoundingBox;
% use it to get roi in my images without cropped it
im2 = im .* uint8(bw);
figure; imshow(im2, []);
  2 件のコメント
messaoudi nada
messaoudi nada 2021 年 10 月 27 日
@yanqi liu thanks so much sir for your help , it work well ! but i have another problem here , my objective is to extract features from ROI , i dont know why the program extract features from background ! is there any way to resolve this problem ? how can i remove this features point from background
yanqi liu
yanqi liu 2021 年 10 月 28 日
clc; clear all; close all
ch = 'cameraman.tif';
row = 256;
colum = 256;
% ch=strcat('C:\Users\nada\Desktop\nadamastere\bd\fatigue\p1\image_',num2str(v,'%d'),'.png');
I1=imread(ch);
I1=imresize(I1,[row,colum],'bilinear');
% I1=rgb2gray(I1);
im = I1;
I1=im2double(I1);
I1=im2bw(I1);
figure(2);imshow(I1);
roI=imrect(gca,[20 20 110 120]);
bw=createMask(roI);
figure(3);imshow(bw);
props = regionprops(bw,'BoundingBox');
b =props(1).BoundingBox;
% use it to get roi in my images without cropped it
im2 = im .* uint8(bw);
% extract features
corners = detectFASTFeatures(im2,'ROI',[20 20 110 120]);
figure; imshow(im2, []);hold on;plot(corners.selectStrongest(50));

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

その他の回答 (1 件)

Image Analyst
Image Analyst 2021 年 10 月 26 日
bw=createMask(roI);
bw = bw & I1; % Combine it with the binary blobs from the thresholded face.
props = regionprops(bw,'BoundingBox');
  2 件のコメント
messaoudi nada
messaoudi nada 2021 年 10 月 27 日
@Image Analyst thanks sir i did it , but why the features detected from background and not from ROI ? even when i tried to convert image from RGB to YCBCR , the features are detected from background !
Image Analyst
Image Analyst 2021 年 10 月 27 日
You've accepted @yanqi liu's answer so I guess you got it all figured out now.

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

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by