简体   繁体   English

我无法使用 python 打印图像的像素值

[英]i am not able to print the values of pixels of my image using python

I am trying to calculate the pixels of a raster image using python, and i found this code in the website:我正在尝试使用 python 计算光栅图像的像素,我在网站上找到了以下代码:

path4 = "./bmp.bmp"
brownbox= cv2.imread(path4)
brownkbox=cv2.resize(brownbox, (0,0), fx=0.5, fy=0.5)
brownbox2_gray= cv2.cvtColor(brownbox, cv2.COLOR_BGR2GRAY)
cv2.imshow("gray",brownbox2_gray)
cv2.waitKey(0)

rows,cols = brownbox2_gray.shape
for i in range(rows):
    for j in range(cols):
        k = img[i,j]
        print (k)

k values are not being printed? only the images are shown
import numpy as np 
from PIL import Image

i = Image.open('name of your jpg.jpg')
array = np.asarray(i)
print(array)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我无法使用导入图像方式将图像导入python - I am not able to import an image into python using the import image way 我无法在我的emotion.html 中打印变量 - I am not able to print variable in my emotion.html 使用 Python 映射图像中的像素值 - Mapping values of pixels in an image with Python 如何在2.7.12中使用python print()函数? - How am I able to use python print() function in 2.7.12? Python 3:我试图通过使用 np.array 遍历所有像素来查找图像中的所有绿色像素,但无法绕过索引错误 - Python 3: I am trying to find find all green pixels in an image by traversing all pixels using an np.array, but can't get around index error OpenCV / python:如何使用公式更改图像像素的值? - OpenCV/python: How to change image pixels' values using a formula? 我无法使用python在电子邮件正文中添加图片,我可以添加图片作为附件,但我想要代码在邮件正文中添加图片 - I am not able to add an image in email body using python , I am able to add a picture as a attachment but i want a code to add image in mailbody 为什么我无法使用python3在熊猫列中删除值? - Why am I not able to drop values within columns on pandas using python3? 我正在尝试使用 for 循环打印转义字符。 我的动机是查看打印出来的值 - I am trying to print escape characters using for loop. My motive is to see the values that gets printed 如何使用 OpenCV-Python 访问图像的像素? - How do I access the pixels of an image using OpenCV-Python?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM