November 22, 2019 Development Notes

Began to consider using filtering function, after using several popular filtering function, we found both speed and time are not satisfactory, and decided to write one.

First, make a mask mask two rows, the first row 0, 10 behavior before and after the 10 second line 1, the line is divided into the following two pictures fttmove function of the line after the split are combined and Fourier transformation, the mask is multiplied with the array, to obtain low-pass filtered image, the image is an inverse Fourier transform energy FIG.

Iimg a mask image and do the same size, using np.astype the image point is converted into integers and stored in iimg, set a filtering threshold lvValue, when there is an element <lvValue, to replace 0 when there is an element> 255-lvValue, replace it with zero. Use np.convolve of iimg do convolution operation. Finally, dynamic filtering effect is obtained:


Extract its contour drawing a rectangle:

To obtain results as shown.
Now the effect of treatment has been basically satisfied, the next step is to extract the outer contour is then ready for the cross-compile the Linux machine.
Think of when writing notes image processing stage is already almost formed, and come back later to see if there is no time to send a summary. The next stage is to target identification and tracking, and machine learning to use the content. The idea now is to first take a general BP neural network parameter adjustment crazy then, what is behind you now use to learn, ah, in general, so be it, for the week to get the image processing section, and then say something. 

Filter code:
DEF fttmove (Frame1, Frame2): 
    index = 0
     for I in Range (0, High, SteppingH): 
        new_gray_array [0 ,:] = Frame1 [I, :: SteppingW] 
        new_gray_array [ . 1 ,:] = Frame2 [I ,: : SteppingW] 

        F = np.fft.fft2 (new_gray_array) 

        F = F * mask 

        ifft2line = np.fft.ifft2 (F) 

        iimg [,: index] = ifft2line.astype (np.int) [. 1 ,:] # NP .astype converts the image to an integer 
        iimg [index,:] [iimg [index ,:]> 255 - lvValue] = 0      # has elements> lvvaule replaced by the value x:
        iimg [index,:] [iimg [index,:] <lvValue] = 0    # all elements <lvValue to replace 0 
        iimg [,: index] = np.convolve (iimg [index ,:], conMask, MODE = ' Same ' )   # numpy function convolution library 
        # Print ( 'iimg_arry =' + STR (iimg [,: index])) 
        # start2 time.clock = () 
        # Print ( 'Time2: S%'% ( start2 - Start1)) 
        index = index +. 1 return iimg
    

 

 

 
 

Guess you like

Origin www.cnblogs.com/lvfengkun/p/11914712.html