Analyze the AJAX request and capture “Today’s Headline’s Street Shooting”

2023-01-26  

[Time] 2019.09.04 
 [Title] Transform.similalicytransform () of the Skimage libraryI. SimiLARITYTRANSFORMSimilar transformation: Waiting transformation+uniform scale zoom, the so -called equivalent transformation is translation+rotation transformation.

transform matrix:

transform effect: angle, parallelism and verticality do not change.

2, transform.similalicytransform () usage

Reference: Help (TF.SIMILARITYTRANSFORM)

Input parameters:

  • matrix : (3, 3) array, optional , Homogeneous transformation matrix.

optional, that is, the (3,3) change matrix in the above (3,3), depending on the description below.

  • scale: float, optional (zoom factor, S)
  • rotation : float, optional  Rotation angle in counter-clockwise direction as radians.

(Rotating angle θ, counterclockwise, expressed from the angle from the arc)

  • translation : (tx, ty) as array, list or tuple, optional ,x, y translation parameters.

Transfer parameters (TX, TY)

Return:

A SKIMAGE.TRANSFORM._Geometric.similalicytransform Object
(3,3) Quality change matrix: 

       [[A0 B0 A1] 
        [B0 A0 B1] 
        [0 0 1]] 
 Compared with the transformation matrix, we can see: A0 = S * cos (rotation), B0 = s * sin (rotation), A1 = TX, B1 = TY.

The final similar transformation result of this is:

 X = a0 * x - b0 * y + a1 =
   = s * x * cos(rotation) - s * y * sin(rotation) + a1

 Y = b0 * x + a0 * y + b1 =
   = s * x * sin(rotation) + s * y * cos(rotation) + b1
3. Related methods:

3.1 ESTIMATE (SELF, SRC, DST): From a set of corresponding points (source point, target point), estimate change matrixinput parameters: 
  | src: (n, 2) array 
  | Source Coordinates. (Source coordinates) 
  | dst: (n, 2) array 
  | Destination Coordinates. 
  return: 
  | Success: BOOL 
  | True, if Model Estimation Succeeds.3.2 INVERSE (Self, Coords): From the target coordinates, the source coordinates| Apply Inverse Transformation. 
 Input parameters:     

  | Coords: (n, 2) array 
  | Destination Coordinates. 
 return:  
  | Coords: (n, 2) array 
  | Source Coordinates.3.3 Residuals (SELF, SRC, DST): Determine the residues of the target coordinates after the conversion, and determine the distance between Eujide with each source coordinates to each target coordinate.Input parameters: 
  | src: (n, 2) array 
  | Source Coordinates. 
  | dst: (n, 2) array 
  | Destination Coordinates. 
 return: 
  | Residuals: (n,) array 
  | Residual for coordinal. 
  | |

4, example

4.1

from skimage import transform as trans
import numpy as np
src = np.array([
    [38.2946, 51.6963],
    [73.5318, 51.5014],
    [56.0252, 71.7366],
    [41.5493, 92.3655],
    [70.7299, 92.2041] ], dtype=np.float32)
dst = np.array([
    [38.2946, 51.6963],
    [73.5318, 51.5014],
    [56.0252, 71.7366],
    [41.5493, 92.3655],
    [70.7299, 92.2041] ], dtype=np.float32)
tform = trans.SimilarityTransform()
res =tform.estimate(dst, src)
M = tform.params
print(res)
print(M)

[Run results]:

4.2

from skimage import io,data
from skimage import transform as tf
img = data.camera()
io.imshow(img)
tform = tf.SimilarityTransform(scale=1.5,rotation=np.deg2rad(10),translation=(10,12))
img1 = tf.warp(img,tform)
io.imshow(img1)

Original mapThe picture after similar transformation

source

Related Posts

Ascended salary increase must be seen! Take you to comprehensively understand the View’s drawing process, I’m sorry for not being able to penetrate

vs2015 64 -bit system under Mapwingis.ocx configuration

Linux/CentOS system hangs a new hard disk simple tutorial (detailed)

Openark installation tutorial

Analyze the AJAX request and capture “Today’s Headline’s Street Shooting”

Random Posts

JS DateTime type to the front end iOS is not compatible

JS determine whether the input string is empty, space, null summary

Android fast implementation file download (only 4 lines of code) laer

RTSP protocol video intelligent monitoring platform Easynvr uses mysql as a data source to start an error of the Unknow Driver “mysql”

Real time display time The