I have a image in greyscale. I have the value of each pixel saved to a text document that I pre-processed and loaded as an array, therefore my array has size 110529.
An example of how my array looks like:
import numpy as np
my_array = np.random.randint(low=18., high=36,size=(110592))
Then, I used OpenCV to draw a ROI around the face in my image like this:
x, y, w, h = cv2.selectROI(my_frame)
and the values of x, y, w, h are:
95 2 184 286
What I want to do is use the pixel indices in the ROI from that image as reference and use those indices to extract to a new array the values that are inside my_array, so I can have a filtered array with 52624 temperature values that corresponds to the ROI in the image
what you wanted is not called "filtering" but a "numpy slice" :
x, y, w, h = cv2.selectROI(my_frame)
roi = my_frame[y:+h, x:x+w]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.