2016年2月9日星期二

Week 1 Single Color Image and Its Combine Pattern

   In week 1, our group had a meeting about the second year project. The material was a paper whose name is Terahertz pulsed spectroscopic imaging using optimized binary masks authored by Dr. Y.C. Shen. We learned some basic knowledge about this project, the function to process the images. The image can be processed by the points on the following:

  • For one specific image with fixed pixels, the first thing is to determine the numbers of the pixels. 
  • Divide the image into several parts.
  • Create the mask pattern with pixels. 
  • Combined the original image with the mask pattern. 
  • Reconstruct the image and output the reconstructed image. 

   On the first week, our group changed the numbers of the mask pattern to find the result of the reconstruction of the original image. We found that with the increasement of the mask patterns, the quality becomes better which illustrates the relationship between the mask patterns and the reconstructed image is linear. 
    The result of the program with the mask pattern size 90, 180, 270 is attached at the end.  

    The flow chart is on the following:


The flowchart of the image processing
The code for the first week can be seen on the following:
% test linear_rec(THzData, MaskData)
clear all;

% sample pattern
NP=40; % number of pixels
ima=zeros(NP);ima(:,1:3)=1; ima(:,14:16)=1; ima(:,24:26)=1; ima(:,38:40)=1; ima(1:3,:)=1;ima(14:16,:)=1;ima(24:26,:)=1; ima(38:40,:)=1; %establish a 32*32 zero matrix,sample pattern
figure(1),subplot(2,2,1),imagesc(ima), title('original image')
% simulate mask set data
NM=90; % nunmber of masks

% mask data
MaskData=zeros(NM,NP*NP);
subplot(2,2,2),im1=imagesc(ima);title('mask pattern')
subplot(2,2,3),im2=imagesc(ima);title('combined')
for i=1:NM
    temp=rand(NP); temp=temp>0.5;
    MaskData(i,:)= temp(:);
    pause(0.1)
    temp1=reshape(temp,NP,NP);%mask pattern
    set(im1,'CData',temp1);
    temp=temp1.*ima; %combined patten
    set(im2,'CData',temp);
end
% THz data
THzData=MaskData*ima(:); % simulate terahertz measurement data
% reconstruction
newimg=linear_rec(THzData, MaskData); % call the reconstruciton function
% reifne and plot
newimg=squeeze(newimg);   
newimg=newimg.*(newimg>0);
figure(1);subplot(2,2,4),imagesc(newimg);% display the reconstructed image
title('Results of Linear Reconstruction');




The result of 90 Mask Pattern

The result of 180 Mask Pattern



The result of 270 Mask Pattern
                                    






1 条评论: