Pressure to Images and Images to pressure conversion

烂漫一生 提交于 2019-12-13 04:19:01

问题


EDIT:I am working on the Pressure map dataset where the pressure sensors data is "in-bed posture pressure data".

Dataset : https://physionet.org/content/pmd/1.0.0/

Using the below code I could able to convert the pressure data to images.

line = f.readlines()[3]
lst1 = line.strip().split()
lst = [int(x) for x in lst1]

# Convert into a 64*32 array
rr = np.asarray(lst).reshape(64, 32)

plt.imshow(arr, cmap='hot', interpolation='nearest')

Images formed are as below:

Now, my major motto is to analyze each body part individually. For that, I am taking the bounding boxes for body parts and then I need to get the original sensor data in that part and then analyse using the pressure values.

Let say I am analysing the head part. For that, I have to get the original pressure data of that sub-portion. Sub-portion is decided by the bounding boxes using the images.

How can I get the original pressure values using the bounding boxes of images?


回答1:


Reading your comments I think you used the output image to determine the position of the head. However the output image is scaled up, meaning more pixels then the amount of data points. That is why your range is outside of the array dimensions.

Here is an image where each data point is 1 pixel (hard to see, in gray values):

I plotted the same image using your code:

Notice how you can count the actual data points as blocks of color. The axis equal data point count in column/row. I had the mouse on the head position, so it's (rounded) location is at x=13, y=3.

Then, selection of the general head area:

head = arr[1:7,10:18]
print(head)
plt.imshow(head, cmap='hot', interpolation='nearest')

Gives values:

[[ 49 54 99 182 214 106 33 35]
[ 22 49 229 257 314 224 81 5]
[ 15 55 131 194 177 199 59 5]
[ 7 20 61 96 144 346 19 3]
[ 2 3 19 33 60 83 10 0]
[ 9 5 11 13 72 46 2 0]]

It may be a little hard to see, because the colors are remapped.



来源:https://stackoverflow.com/questions/58128400/pressure-to-images-and-images-to-pressure-conversion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!