Ask Your Question

charles1208's profile - activity

2020-05-16 18:48:14 -0600 received badge  Popular Question (source)
2018-06-05 01:42:12 -0600 edited question cvtColor vs reading image directly

cvtColor vs reading image directly I have the following: string input = "test.jpg"; cv::Mat tmp = cv::imread(input, CV

2018-06-05 01:35:03 -0600 asked a question cvtColor vs reading image directly

cvtColor vs reading image directly I have the following: string input = "test.jpg"; cv::Mat tmp = cv::imread(input, CV

2018-05-30 22:14:38 -0600 marked best answer imread, imwrite does not give similar image

I have the following code:

string src = "a.jpg";
string dest = "a_out.jpg";

cv::Mat im = cv::imread(src, CV_LOAD_IMAGE_COLOR);
cv::imwrite(dest, im);
cv::Mat im2 = cv::imread(dest, CV_LOAD_IMAGE_COLOR);
isMatEqual(im,im2);

where:

bool isMatEqual(const cv::Mat & a, const cv::Mat & b)
{
    if ( (a.rows != b.rows) || (a.cols != b.cols) )
        return false;
    cv::Scalar s = sum( a - b );
    return (s[0]==0) && (s[1]==0) && (s[2]==0);
}

However, I get a return that is false. Is there something wrong my reading/writing of the images?

2018-05-30 03:31:58 -0600 asked a question imread, imwrite does not give similar image

imread, imwrite does not give similar image I have the following code: string src = "a.jpg"; string dest = "a_out.jpg";

2018-04-09 06:38:13 -0600 asked a question Calculating original image points with perspectiveTransform()

Calculating original image points with perspectiveTransform() Given a pair of images, imgA and imgB, i resized them firs

2018-03-22 21:45:44 -0600 marked best answer Using getPerspective to warp image to forward facing

I have an image that I want to stretch to cover the entire screen after transformation.

My code is as such:

src = np.array([[0, 0], [997, 102], [1000, 600], [0, 995]], np.float32)
dst = np.array([[0, 0], [997, 0], [1000, 995], [0, 995]], np.float32)
M = cv2.getPerspectiveTransform(src, dst)
warped = cv2.warpPerspective(img, M, (1000, 1000))

where the src coordinates refer to the 4 red points in the image, in clockwise order.

The dst coordinates refer to the 2 red points on the left, and the 2 blue points on the right of the image, in clockwise order.

The idea is that I want to "stretch" the image such that the 2 red points on the right correspond to the 2 blue points.

enter image description here

However, the warped image turns out to be:

enter image description here

Is there something I did wrong, or assumed wrongly about the usage of the functions?

2018-03-22 02:11:57 -0600 asked a question Using getPerspective to warp image to forward facing

Using getPerspective to warp image to forward facing I have an image that I want to stretch to cover the entire screen a

2018-03-18 06:34:09 -0600 commented question Finding the real-world distance of object from pixel coordinates

@berak unfortunately i do not know the distance to the camera; i only know the actual distance between the 2 blue lines.

2018-03-18 05:27:33 -0600 edited question Finding the real-world distance of object from pixel coordinates

Finding the real-world distance of object from pixel coordinates I have a picture of a supermarket shelf, with its top-m

2018-03-18 05:26:34 -0600 asked a question Finding the real-world distance of object from pixel coordinates

Finding the real-world distance of object from pixel coordinates I have a picture of a supermarket shelf, with its top-m

2018-03-18 04:49:40 -0600 commented question Eliminating erroneous non-converging lines

There is a change to the scope of my question. I will delete this current one and rephrase it better with another one. T

2018-03-16 03:15:37 -0600 asked a question Eliminating erroneous non-converging lines

Eliminating erroneous non-converging lines I am trying to detect shelf lines at a supermarket. In the picture attach

2018-02-10 21:44:22 -0600 commented question Recreating lighting based on sample image

Not exactly. What i am looking for is more of like to simulate how an image of an object would look like under different

2018-02-10 09:22:54 -0600 edited question Recreating lighting based on sample image

Recreating lighting based on sample image Hi, I am wondering if there is any current research/implementation to this pr

2018-02-10 09:21:43 -0600 edited question Recreating lighting based on sample image

Recreating lighting based on sample image Hi, I am wondering if there is any current research/implementation to this pr

2018-02-10 09:20:02 -0600 asked a question Recreating lighting based on sample image

Recreating lighting based on sample image Hi, I am wondering if there is any current research/implementation to this pr

2018-01-12 02:03:16 -0600 marked best answer Cropping keypoints vs. cropping image and finding keypoints

Given an image of many items, with all of its bounding box known in pixel coordinates.

I am trying to extract a region (surrounding) around each of the items, calculate its descriptors and features using AKAZE, to do comparison with one another.

However I realised that this might be too slow, since it involves:

1) cropping each and every single item to generate many images then,

2) detecting and computing on each image to generate the keypoints and descriptors.

Alternatively, to speed things up, I was thinking of:

1) Resizing the entire image, then perform the detecting and computing of keypoints once.

2) Then to obtain the keypoint of a particular object, we simply retrieve the set of precalculated keypoints corresponding to the objects location.

My question is this method functionally sound, and that if there are any consequences to this?

2018-01-12 01:00:26 -0600 received badge  Enthusiast
2018-01-09 22:22:36 -0600 asked a question Cropping keypoints vs. cropping image and finding keypoints

Cropping keypoints vs. cropping image and finding keypoints Given an image of many items, with all of its bounding box k

2017-11-30 22:51:26 -0600 commented question knnMatch gives different results between debug and release Mode

Not really. For this it ran okay under release, but under debug, the following error appears: Assertion failed in cv::Tl

2017-11-29 00:13:24 -0600 edited question knnMatch gives different results between debug and release Mode

knnMatch gives different results between debug and release Mode I am trying to use the BFMatcher class for Akaze auto b

2017-11-29 00:11:22 -0600 received badge  Editor (source)
2017-11-29 00:11:22 -0600 edited question knnMatch gives different results between debug and release Mode

knnMatch gives different results between debug and release Mode I am trying to use the BFMatcher class for Akaze auto b

2017-11-28 22:24:13 -0600 commented question knnMatch gives different results between debug and release Mode

Yes I am using windows/VS, but i checked that the debug are linked to the *d.lib files while the release are linked to t

2017-11-28 21:13:47 -0600 asked a question knnMatch gives different results between debug and release Mode

knnMatch gives different results between debug and release Mode I am trying to use the BFMatcher class for Akaze auto b

2017-11-28 12:11:20 -0600 received badge  Student (source)
2017-11-28 05:16:29 -0600 marked best answer Cropping of images in c++ vs python

I got a strange error that I couldn't figure out where i went wrong.. I am trying to port from Python over to C++ the following cropping code:

In Python:

# x, y, w, h refers to the ROI for which the image is to be cropped.
img = cv2.imread('test.jpg')
cropped_img = img[y: y + h, x: x + w]

In C++:

auto img = cv::imread("test.jpg");
auto resized_img = img(cv::Rect(x, y, w, h));

The values used are exactly the same. However the c++ version throws the exception:

OpenCV Error: Assertion failed (0 <= roi.x && 0 <= roi.width && roi.x + roi.width <= m.cols && 0 <= roi.y && 0 <= roi.height && roi.y + roi.height <= m.rows) in cv::Mat::Mat
2017-11-28 05:16:29 -0600 received badge  Scholar (source)
2017-11-28 04:47:35 -0600 asked a question Cropping of images in c++ vs python

Cropping of images in c++ vs python I got a strange error that I couldn't figure out where i went wrong.. I am trying to