Files
AVM360/surround_view/__pycache__/utils.cpython-38.pyc

46 lines
4.0 KiB
Plaintext
Raw Normal View History

2026-04-01 14:11:47 +08:00
U
<00>
<EFBFBD>i<EFBFBD><00>@shddlZddlZddd<07>Zdd <09>Zd
d <0B>Zd d <0A>Zdd<0F>Zdd<11>Zdd<13>Z dd<15>Z
ddd<18>Z dd<1A>Z dS)<1D>N<><4E><00>8<00><00>YUYVc Cs,td<01>d|<00>d|<04>d|<01>d|<02>d|<03>d<07> S)NZ#11111111233333333333545656646464646zv4l2src device=/dev/videoz ! video/x-raw,format=z,width=z,height=z ,framerate=z5/1 ! videoconvert ! video/x-raw,format=YUYV ! appsink)<01>print)Zcam_idZ capture_widthZcapture_heightZ framerate<74>format<61>r<00>&/home/ztl/LJ360/surround_view/utils.py<70>gstreamer_pipelines"<22>r
cCs|<00>tj<02>d<00>t<03>S)zv
Convert a binary image (only one channel and pixels are 0 or 255) to
a bool one (all pixels are 0 or 1).
<20><00>o@)<04>astype<70>np<6E>float<61>int<6E><01>maskrrr <00>convert_binary_to_boolsrcCst<00>||d<01><02>tj<03>S)z@
Adjust the luminance of a grayscale image by a factor.
<20><>)r <00>minimumr <00>uint8)<02>gray<61>factorrrr <00>adjust_luminance srcCst<00>||<00>S)z<>
Get the total values of a gray image in a region defined by a mask matrix.
The mask matrix must have values either 0 or 1.
)r <00>sum)rrrrr <00>get_mean_statistisc'srcCst||<02>t||<02>S<00>N)r)ZgrayAZgrayBrrrr <00>mean_luminance_ratio/srcCs(t<00>|tj<02>}t<00>|ddtj<04>\}}|S)z+
Convert an image to a mask array.
rr)<05>cv2<76>cvtColor<6F>COLOR_BGR2GRAY<41> threshold<6C> THRESH_BINARY)<04>imgr<00>retrrrr <00>get_mask3sr$cCs2t<00>||<01>}t|<02>}tj|t<04>dtj<06>dd<03>}|S)zv
Given two images of the save size, get their overlapping region and
convert this region to a mask array.
<20><02>r&r&<00>Z
iterations)r<00> bitwise_andr$<00>dilater <00>onesr)<04>imA<6D>imBZoverlaprrrr <00>get_overlap_region_mask<s r-cCstt|<00>}tj|t<03>dtj<05>dd<03>}t<01>|tjtj<08>dd<05>\}}t |dd<07>dd <09>d
}t<01>
|d t<01> |d<08>d<08>}|S) z<>
Given a mask image with the mask describes the overlapping region of
two images, get the outmost contour of this region.
r%r&r'<00><><EFBFBD><EFBFBD><EFBFBD>NcSs
t<00>|<00>Sr)r<00> contourArea)<01>xrrr <00><lambda>T<00>z.get_outmost_polygon_boundary.<locals>.<lambda>T)<02>key<65>reverserg;<3B>O<EFBFBD><4F>n<EFBFBD>?) r$rr)r r*r<00> findContours<72> RETR_EXTERNAL<41>CHAIN_APPROX_SIMPLE<4C>sorted<65> approxPolyDP<44> arcLength)r"rZcntsZ hierarchy<68>CZpolygonrrr <00>get_outmost_polygon_boundaryGs<04><02> r<<00>cCs<>t||<01>}t<01>|<03>}t<03>|dk<02>}tj|||d<02>}tj|||d<02>}t|<00><01>tj<08>d}t |<06>} t |<07>}
t
|<05>D]d\} } t t | <0C>t | <0B>g<02>} t<01> |
| d<04>}||krnt<01> | | d<04>}||9}||9}||||| | f<qn||fS)zM
Get the weight matrix G that combines two images imA, imB smoothly.
rrr T)r-r<00> bitwise_notr <00>wherer(r$r <00>float32r<<00>zip<69>tupler<00>pointPolygonTest)r+r,Zdist_thresholdZ overlapMaskZoverlapMaskInv<6E>indicesZimA_diffZimB_diff<66>GZpolyAZpolyB<79>yr0Zxy_tupleZdistToBZdistToArrr <00>get_weight_mask_matrix\s"

rGc Cs<>t<00>|<00>\}}}t<02>|<01>}t<02>|<02>}t<02>|<03>}|||d}||}||} ||}
t||<08>}t|| <09>}t||
<EFBFBD>}t<00>|||f<03>S)zM
Adjust white balance of an image base on the means of its channels.
<20>)r<00>splitr <00>meanr<00>merge) <0B>image<67>BrE<00>R<>m1<6D>m2<6D>m3<6D>K<>c1<63>c2<63>c3rrr <00>make_white_balancezs





rV)rrrrr)r=) r<00>numpyr r
rrrrr$r-r<rGrVrrrr <00><module>s <00>