python - Understanding the OpenCV Sample stereo_match.py code -


i trying understand opencv sample stereo_match.py. place mask, out_points, , out_colors calculated not able understand. code related given below:

mask = disp > disp.min() out_points = points[mask] out_colors = colors[mask] 

here, know is, mask, points , colors numpy arrays of size 555x641. when above operation done, out_points , out_colors become 300000x3 arrays.

what logic behind , how achieve functionality in pure python(that lets points, colors , mask normal arrays, , need above operation out using numpy , calculate out_points , out_colors)?

thank you

i'll explain code:

mask = disp > disp.min() 

here mask 2d array same height , width disp, values stored boolean. each value disp calculated logic statement: x > disp.min()

out_points = points[mask] out_colors = colors[mask] 

these arrays values points , colors stored true in mask-array. image 555x641 = 350k pixels, 300k arrays within size. color images have 3 layers, 300k x 3 makes sense.

you can these operations without numpy, guess slow down code bit. if have other questions, please ask!


Comments