Image banding twill type distortion --reshape difference operation row by row data taken

Garbled striped twill-like image appears

Figure
Here Insert Picture Description

Currently In both scenarios, it appeared on the map and on the map similar results:

Case1 : ENVI remote sensing image open, and manually add the header files, edit images ranks number (samples and lines), when the input ranks number does not match with the actual image, similar cases will appear on the map.

Case2 : When do inversion when the input vector matrix variable model, the output vector then changed back to the matrix, when reshape the wrong, the results appear on the map.
For example, for a matrix input, generates a column vector inputted into the inside of the model with the following code:

for i=1:m
    for j=1:n
        templat=lat2-0.03*(i-1);   %中心像素的纬度
        templon=lon1+0.03*(j-1);   %中心像素的经度
        
        %生成经纬度的列向量
        lat(count,1)=templat;
        lon(count,1)=templon;
        
        %生成变量LC的列向量
        mm=ceil((53.505-templat)/0.03);
        nn=ceil((templon-73.645)/0.03);
        LC(count)=LCdata(mm,nn);
        
     end
end

This code isData fetch rows, Into a column vector of the matrix;
column vector input model, the output still is a column vector, a matrix need to reshape. Matlab inside reshape defaultData fetch columnsIf you required to take the data in rows, the need for transposition. For example, the column vector A is changed into a matrix of m * n:
1) If in accordance withRowTake, should be written: the RESHAPE (A, m, n-)
2) If in accordance withRowTake, should be written: reshape (A ', n, m)'

We look at the differences in the results of the code under the two Matlab:

% 按行与按列取数据的不同结果

% 原始的列向量
A=[1,2,3,4,5,6]'

%按列取数据
B=reshape(A,2,3)

%按行取数据
C=reshape(A',3,2)'

The output is:

Here Insert Picture Description
If the matrix converter used in fetching data rows column vector, then the amount back to the column matrices, we should maintain the same row fetch data , or the result will appear as shown above (for all operations reshape).

Released nine original articles · won praise 20 · views 7133

Guess you like

Origin blog.csdn.net/Yqq19950707/article/details/89892409
Row