【问题标题】:Python - video processing. How to: 1) change pixels value in videos (ie pixelated effect), and then 2) retrieve every single pixel's informationPython - 视频处理。如何:1)更改视频中的像素值(即像素化效果),然后 2)检索每个像素的信息
【发布时间】:2021-10-05 13:50:20
【问题描述】:

这个问题与一个实际的科学项目有关。 1. 视频将在黑色背景表面上以白色移动物体为媒介完成。最终结果将接近黑白输出,但我还需要将视频渲染为实际的双色通道视频(仅显示黑白像素)。我想删除/减少噪音(由光干扰引起的不相关的白色像素)也应该很有用 2. 之后,我需要修改像素值以获得像素化效果 3。此时,我需要从所有帧中获取所有像素值,可能以矩阵方式排列,因为我需要对这些矩阵执行一些计算数学

让我给你看一个例子:

 frame 1. (0 for black pixel values, 1 for white pixel values)
              01110000
              01111001
              01100011
              11101111
              01100000 
              10000000

frame 2.      00111000
              01011100
              11100000
              10010100
              10000101
              01010101

等等……

【问题讨论】:

  • 您应该发布示例数据(图像/视频)。如果可能的话,保持不变的数据。显示问题并且可用于演示解决方案的潜在答案的东西。 ascii 艺术几乎没有显示任何东西,你甚至没有指出它应该显示什么。

标签: python opencv data-analysis pixel video-processing


【解决方案1】:
# You could store it in a list like this:

frame1 = [.01110000, .01111001] # and so on. Because an int can't start on zero, I made these decilams

# To change the first item in this list do the following

frame1[0] = .01110011 # This will be the new value and the current list looks like this:
# frame1 = [.01110011, .01111001]

# To retrieve information about every element in the list simply use a for loop
n = -1
for element in frame1:
    n += 1
    element = frame1[n]
    print(element)

【讨论】:

  • 我真的不明白你在问什么,所以我尽力掌握了手头的信息。我如何改进我的回答来帮助您解决问题?
  • 我不是提出这个问题的人。那将是@Enzo。我来这里只是因为我在 opencv 标签中寻找有趣的问题。我会重复我的观点:这个答案甚至没有解决这个问题。
  • @ChristophRackwitz 你是对的。塞缪尔非常友善,但未能给出有用的答案。
  • @Samuel 你能告诉我你在问题中没有得到什么吗?尽量做到具体,我也会这样做
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-02-13
  • 2013-02-03
  • 1970-01-01
  • 1970-01-01
  • 2020-07-30
  • 2021-09-17
相关资源
最近更新 更多