图像压力和图像压力转换 [英] Pressure to Images and Images to pressure conversion

查看:158
本文介绍了图像压力和图像压力转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理压力图数据集,其中压力传感器数据为床内姿势压力数据".

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

数据集: 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')

形成的图像如下:

现在,我的主要座右铭是分别分析每个身体部位.为此,我要使用身体部位的边界框,然后需要获取该部位的原始传感器数据,然后使用压力值进行分析.

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?

推荐答案

阅读您的评论我认为您使用输出图像来确定头部的位置.但是,输出图像会按比例放大,这意味着比数据点的数量更多的像素.这就是为什么您的范围超出数组维度的原因.

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.

这是一个图像,其中每个数据点均为1像素(很难看到,为灰度值):

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:

请注意如何将实际数据点计数为颜色块.轴等于数据点数(以列/行为单位).我将鼠标放在头部位置,所以它的(圆形)位置是x = 13,y = 3.

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')

给出值:

[[49 54 99182 214 106 33 35]
[22 49 229 257 314 224 81 5]
[15 55 131 194 177 199 599 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]]

[[ 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.

这篇关于图像压力和图像压力转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆