473,383 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

how to know metrix(x,y) of color in the image with OpenCV

i would like to know position of color
EX. i draw rectangle (10,10) to (256,256) green color
and i print(img[10,10]) >> [255,0,0]
but i need to know where position is [255,0,0]
if i have the image some point is green but i don't know position


import cv2
import numpy as np
img = cv2.imread('BG-Black.jpg')

cv2.rectangle(img,(10,10),(256,256),(0,0,255),-1)
cv2.circle(img,(10,10),2,(255,0,0),-1)
cv2.circle(img,(10,256),2,(255,0,0),-1)
cv2.circle(img,(256,10),2,(255,0,0),-1)
cv2.circle(img,(256,256),2,(255,0,0),-1)

print((img[20,20]))

print([0,0,255])

cv2.imshow("img",img)
cv2.waitKey()
cv2.destroyAllWindows()
Jul 10 '18 #1
0 1258

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Jeremy Bowers | last post by:
I have an image in the Python Image Library. I'm trying to get it into PyGTK in color. Is there any way to do this cross-platform, preferably without writing to anything to the disk? PIL...
2
by: DanS | last post by:
Does anyone know how to change an image from color to black and white / greyscale programmatically in c#? Nothing in the image or bitmap objects looked promising? thanks!
2
by: Mohammad | last post by:
Hello. How I can write a program that save a high color image as 256 color or fewer with .BMP format , just like Microsoft Paint. I want to write this Program with C# .NET , NOT with MFC . Thank...
7
by: Scott Schluer | last post by:
Is there a way to use the Image class to convert a color photo (GIF or JPEG) to a B&W photo? Thanks, Scott
2
by: Ira | last post by:
Is it possible to convert a 32-bit color image into a 1-bit-per-pixel image in VB.net? If yes, how can it be done?
3
by: ShihChengYu | last post by:
Dear all: How to convert color image to bi-level image? I have confronted one problem when I build my OCR project. I used an software API function to enhance my project, but the API only...
1
by: Sugan | last post by:
Hi all, I'm creating a custom button control. I need to show a color image when the button control is enabled and a gray shade of the same image when the button control is disabled. How can i...
0
by: Nhanvu | last post by:
VB.NET Do you know how to know the color of a point(x,y)? And how to know the name of a color if you know its (r, g, b)? I have to check the color of a point, and I don't know how to do! Can...
1
by: donandreone | last post by:
16 bit - 565 (5 bits for the red,6 for green and 5 for blue). Assume that the source bitmap was already loaded in in one buffer - bmpBuf with pixel format 332 (3 bits for red, 3 for green and 2 for...
3
by: Muddasir | last post by:
hi all i need to upload an image and if that image is coloured i need to convert it to black and white image ... till now i only uploaded images ... simple.. have no idea how to do this...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.