Category : image-processing

I am trying to see python and c++ performance difference while using opencv or another library which using for image processing. First Test with python3.8.10 – ubuntu20.04 – opencv4.2.0: import numpy as np import cv2 import time cap = cv2.VideoCapture(0) prev_frame_time = 0 new_frame_time = 0 font = cv2.FONT_HERSHEY_SIMPLEX while(cap.isOpened()): ret, frame = cap.read() if ..

Read more

I’ve been writing a Canny Edge Detection alghorithm using OpenCV (3.4.16) and C++. #include <opencv2/opencv.hpp> #include <iostream> using namespace cv; using namespace std; Mat isteresi(Mat src,int lth,int hth){ Mat dst=Mat::zeros(src.rows,src.cols,CV_8U); for(int i=1;i<src.rows;i++){ for(int j=1;j<src.cols;j++){ if(src.at<uchar>(i,j)>hth){ dst.at<uchar>(i,j)=255; for(int x=-1;x<=1;x++){ for(int y=-1;y<=1;y++){ if(src.at<uchar>(i+x,j+y)>lth) dst.at<uchar>(i+x,j+y)=255; } } } } } return dst; }; Mat noMaxSup(Mat magnitudo,Mat orientation){ Mat ..

Read more

I make image to ASCII converter and I try to resize image using stb_image_resize.h for better result, but i get segmentation fault when resizing the image or in some cases asserts — STBIR_ASSERT (info->channels >= 0) or STBIR_ASSERT (info->channels <= MAX_CHANNELS). I tried to do like in this answer https://stackoverflow.com/a/65873156, but it doesn’t work. prefixes ..

Read more

I am trying to make a image filter in Cuda c++ and i don’t think i understand exactly how does the thread assignment for each pixel work.This is my code so far: imageFilter.cu #include "cuda_runtime.h" #include "device_launch_parameters.h" #include "Filtering_Functions.h" __global__ void Grayscale_image(int h, int w, unsigned char* Image) { int x = (blockIdx.x * blockDim.x) ..

Read more

There is 2 set of points. I want to calculate the transformation between this 2 set .but the number of points are not equal. I looked at ` auto aft = cv::createAffineTransformer(true); aft->estimateTransformation(sourcePoints, targetPoints, ..); that needed to providing matching between point that I haven’t.and i looked this to : auto mat = cv::estimateAffine2D(sourcePoints, targetPoints); ..

Read more