Splitting an image into smaller regions
Afficher commentaires plus anciens
Hi Guys,
I'm working on a code that creates an RGB descriptor for visual search. i've managed to implement the rgb descriptor on the whole image. but i wanted to experiment by splitting the same image up into smaller areas and rerun the experiment by calculating the rgb descriptor on smaller parts of the image.
the reason behind this, is because i'm using a query image against a dataset in order to find visually similar results. but if i split up my image into smaller pieces, i got a feeling it will be more accurate.
my question is, is there a function or piece of code that could help me with this?
Thanks
Réponse acceptée
Plus de réponses (2)
Use mat2cell()
Example:
%Load 256x256 grayscale image and divide in 4x4 equally sized subimages
n=4;
I = imread('cameraman.tif');
I_sub=mat2cell(I,ones(1,n)*256/n,ones(1,n)*256/n)
repeat for each RGB channel
hasan alhussaini
le 17 Mar 2018
0 votes
4 commentaires
Image Analyst
le 17 Mar 2018
OK. Good luck. Though wouldn't the final sum, Fbin, simply be the sum of all pixel values in the image? Just do
Fbin = sum(yourImage(:));
I also don't know why you're using cells instead of a regular numerical array. Why complicate things?
By the way, they are called "cells", not "bins". Bins are usually names for histograms, which are frequency distributions.
hasan alhussaini
le 17 Mar 2018
Image Analyst
le 17 Mar 2018
So you have 2x4 = 8 total histograms, and you want to sum all the bins to get the histogram of the complete array? Well, if so, that would simply be the histogram of the entire, complete image. Why should it be any different??? Then if you sum that histogram, it's simply the sum of all pixel values. Again, why do you expect anything different?
hasan alhussaini
le 17 Mar 2018
Catégories
En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!