Matlab code for extracting random subwindows/subimages

In summary, the conversation is about a project involving object recognition using decision trees and random subwindows. The person is looking for MATLAB code to extract 16x16 subimages from image files and retrieve their gray values. However, the person providing the summary cannot supply the code and suggests looking at a MATLAB page for guidance on how to extract pixels from an image. They also mention that the person may need to write their own code for this task.
  • #1
amus
1
0
hi,

I am doing project related to object recognition using decision trees and random subwindows.For which i nee d MATLAB code for extracting random subwindows/subimages(size is 16x16) from the image files and after that i need to get the gray values of the subimages.
 
Physics news on Phys.org
  • #2
Welcome to PhysicsForums!

I can't supply that code mostly because I don't have any, nor have I done much image processing in the MATLAB environment. I suspect that, for what you're doing, you're going to need to write some code. (i.e. no free lunch, but you never know what the Google is able to turn up)

If you're just starting out, I recommend looking at the following MATLAB page to see how MATLAB deals with image data:
http://www.mathworks.com/access/helpdesk/help/techdoc/creating_plots/f2-145.html

The page I linked to gives an example of how to extract one pixel from a raster image, you should be able to extend this to randomly extract 16x16 pixels out of your image.
 
Last edited by a moderator:
  • #3
Can anyone please help me with this?

I would recommend using the built-in functions in MATLAB to extract random subwindows/subimages from your image files. You can use the "imcrop" function to specify the size of your subimages and the "imread" function to read in your image files. Then, you can use the "randperm" function to generate a random sequence of indices and use them to select random subwindows from your images. Finally, you can use the "rgb2gray" function to convert your subimages to grayscale and obtain the gray values. I would also suggest looking into other image processing functions in MATLAB that may be helpful for your project, such as "imresize" or "imrotate".
 

FAQ: Matlab code for extracting random subwindows/subimages

What is Matlab code for extracting random subwindows/subimages?

The Matlab code for extracting random subwindows/subimages is a set of instructions written in the Matlab programming language that allows you to randomly select and extract smaller portions of an image or data set.

How do I use the Matlab code for extracting random subwindows/subimages?

To use the code, you will need to have Matlab installed on your computer. Then, you can simply copy and paste the code into the Matlab command window and follow the instructions provided by the code.

What are the benefits of using the Matlab code for extracting random subwindows/subimages?

Using this code can save you time and effort in manually selecting and extracting subwindows/subimages. It also allows for random selection, which can be useful in certain applications such as data analysis and machine learning.

Can the Matlab code for extracting random subwindows/subimages be customized?

Yes, the code can be customized to fit your specific needs. You can modify the code to extract subwindows/subimages of different sizes or to select them from specific regions of the image or data set.

Are there any limitations to the Matlab code for extracting random subwindows/subimages?

One potential limitation is that the code may not work for very large images or data sets due to memory and processing constraints. Additionally, the randomness of the selection may not be evenly distributed in certain cases.

Similar threads

Replies
1
Views
1K
Replies
1
Views
2K
Replies
2
Views
1K
Replies
3
Views
1K
Replies
2
Views
1K
Replies
2
Views
3K
Replies
6
Views
3K
Back
Top