openCv - C++ to python
is there anyway to convert this out.at<uchar>(r, c) = src.at<uchar>(r1, c1); into python
is there anyway to convert this out.at<uchar>(r, c) = src.at<uchar>(r1, c1); into python
#import opencv library
import cv2
import numpy
frame = cv2.imread('dove.png')
if frame is None:
print('Error loading image')
exit()
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
for j in range(0, frame.shape[0]):
for i in range(0, frame.shape[1]):
g = frame[j, i]
frame[j, i] = 255
cv2.imshow('frame', frame)
cv2.waitKey(0)
The code you have made makes a total white image.
The code that i tried to convert to python is this which will help shear and image. Would like to know if you are familiar with it ? http://answers.opencv.org/question/21...
@sjhalayka coded was good one. In C++
out.at<uchar>(r, c) = src.at<uchar>(r1, c1)
to Python
out(r, c) = src(r1, c1)
What i have done so far in python to make image shear: https://pastebin.com/unjgzLh4 , i can see that the shear point have changed, but i really don't know how to apply it to the image :/
In cpp:
out.at<uchar>(r, c) = src.at<uchar>(r1, c1)
in Python:
out[r, c] = src[r1, c1]
The r1 and c1 is same as j, i as @sjhalayka posted the code as above. Btw, I'm on offline for a week.
Asked: 2018-10-17 16:53:40 -0600
Seen: 294 times
Last updated: Oct 17 '18
Area of a single pixel object in OpenCV
build problems for android_binary_package - Eclipse Indigo, Ubuntu 12.04
OpenCV DescriptorMatcher matches
Can't compile .cu file when including opencv.hpp
Using OpenCV's stitching module, strange error when compositing images
compile error in opencv2/flann/lsh_table.h when compiling bgslibrary