Some preprocessing methods in the process of image processing

Source: Internet
Author: User

Logical thinking is always a bottleneck for me. Looking at others in a large number of articles, and I myself also for some trifles suppressed, the article is still empty, the heart really is not a taste. Just in decadent again cheer up once again. Seriously, the image allignment a good study, and strive to turn a body here.

MATLAB will use some of the image preprocessing, the most classic to several degrees of an image matrix Vectorization (vectorize). To put it bluntly, the image matrix is pulled into a long column vector. I used to do this job and would often use the reshape function. But this kind of functional processing method is not MATLAB style, yesterday and the younger brother discussed image allignment problem, suddenly be educated in fact this expression is the simplest

A=a (:)
Think about this is the real Matlab style! himself really is super stupid!

According to this idea you can do a small function that reads the same size JPG images in a given directory and pulls them into a column vector to store in a new matrix:

function [X,colvectorx,numimgs] = Readimgs (folder,imgtype) IMGs = Dir ([Folder '/' imgtype]); Numimgs = size (imgs,1); image = Imread ([Folder '/' IMGs (1). name]);%%normalizeing the image dataimage=normalimg (image); Storing the Image datax = zeros ([Size (Image) Numimgs]); Colvectorx=zeros ([Size (image,1) *size (image,2) *size (image,3) numimgs]);% vectorized datafor i=1:numimgs  image = Double (Imread ([Folder '/' IMGs (i). name]));  if (size (image,3) = = 1)    X (:,:, i) = image;  else    X (:,:,:, i) = image;% I is the index of the image sequence%     Colvectorx (:, i) =reshape (image,1,size (image,1) * Size (image,2) *size (image,3)) ';%I T ' s so stupid    Colvectorx (:, i) =image (:) '; endend
over! The writing is ugly, we barely look at .......


Some preprocessing methods in the process of image processing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.