Can I extract the ROIs into separate images for classification?

3 views (last 30 days)
If I use the ROI tool to generate a bunch of ROIs, is it possible to extract those ROIs into separate images? It seems to me that some classification schemes, like the example that use HOG features, require separate images. I have one image of a bunch of resistor symbols. Rather than taking a bunch of images, it'd be nice to be able to just extract them from the ROIs themselves.
  2 Comments
Cong Ba
Cong Ba on 31 Jul 2017
Could you clarify which ROI tool you are using? I did something like this before and used a script to save those ROIs into separate images. The logic was just like I_ROI = I_original(...) and imwrite(I_ROI). But it seems you are using more advanced tools :/
Michael Cooper-Stachowsky
Michael Cooper-Stachowsky on 31 Jul 2017
I'm using the "Training image labeller" tool. However, I think you might be on to something. If I can extract the ROIs (I think I can...) then I just imwrite? How did you generate the different file names?

Sign in to comment.

Accepted Answer

Cong Ba
Cong Ba on 31 Jul 2017
Edited: Cong Ba on 31 Jul 2017
Try something like this: (assume you've got your ROIs as seperate matrices, I_ROI_1, I_ROI_2, etc. )
I{1} = I_ROI_1;
I{2} = I_ROI_2;
for i = 1:2
imwrite(I{i}, ['ROI_', num2str(i), '_', datestr(now,'mm-dd HH-MM'),'.jpg']);
end

More Answers (0)

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!