How to merge two image in Xamarin Forms?

Issue I’m developing a Xamarin Forms iOS app. In the xaml file, there is a grid. <Grid x:Name=”QrCodeSite” HeightRequest=”300″ Margin=”37, 37, 37, 0″> <Grid.RowDefinitions> <RowDefinition Height=”*” /> </Grid.RowDefinitions> </Grid> In the related .cs file, I use ZXing.Net.Mobile.Forms to generate a

Continue reading

How to fill a polygon in OpenCV?

Issue The Python code given below draws a triangle, how can I fill it with a color inside? Or another easier way to draw a triangle in OpenCV? pts = np.array([[100,350],[165,350],[165,240]], np.int32) cv2.polylines(img,[pts],True,(0,255,255),2) Solution You have to use cv2.fillPoly(). Illustration

Continue reading

Bitmap image to base64 conversion

Issue I am trying to convert a bitcode image to base64 format. I tried to code like public static String encodeToBase64(Bitmap image, Bitmap.CompressFormat compressFormat, int quality) { ByteArrayOutputStream byteArrayOS = new ByteArrayOutputStream(); image.compress(compressFormat, quality, byteArrayOS); return Base64.encodeToString(byteArrayOS.toByteArray(), Base64.URL_SAFE); } generated

Continue reading

Python3 'cv2.resizeWindow('img', 500,500)' error

Issue I am trying to run this face tracking program provided here, but running the python program returns; Traceback (most recent call last): File "C:\Users\User\Desktop\Projects\Face Tracking\servo\face.py", line 27, in <module> cv2.resizeWindow(‘img’, 500,500) cv2.error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window_w32.cpp:1473: error: (-27:Null pointer) NULL window:

Continue reading

Python3 'cv2.resizeWindow('img', 500,500)' error

Issue I am trying to run this face tracking program provided here, but running the python program returns; Traceback (most recent call last): File "C:\Users\User\Desktop\Projects\Face Tracking\servo\face.py", line 27, in <module> cv2.resizeWindow(‘img’, 500,500) cv2.error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window_w32.cpp:1473: error: (-27:Null pointer) NULL window:

Continue reading

Python3 'cv2.resizeWindow('img', 500,500)' error

Issue I am trying to run this face tracking program provided here, but running the python program returns; Traceback (most recent call last): File "C:\Users\User\Desktop\Projects\Face Tracking\servo\face.py", line 27, in <module> cv2.resizeWindow(‘img’, 500,500) cv2.error: OpenCV(4.5.5) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window_w32.cpp:1473: error: (-27:Null pointer) NULL window:

Continue reading

image regions corrupt after applying squared filter

Issue I have this image: I am applying a low-pass square filter to that: def SquareFilter(imgShape,size): filterSquare = np.zeros(imgShape) filterSquare[ imgShape[0]//2-size//2 : imgShape[0]//2+size//2, imgShape[1]//2-size//2 : imgShape[1]//2+size//2 ] = 1 return filterSquare im = cv2.imread("Images/wall.jpg",0) freq = np.fft.fft2(im) freq2 = np.fft.fftshift(freq)

Continue reading

Error: (-215:Assertion failed) npoints > 0 while working with contours using OpenCV

Issue When I run this code: import cv2 image = cv2.imread(‘screenshoot10.jpg’) cv2.imshow(‘input image’, image) gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) edged = cv2.Canny(gray, 30, 200) cv2.imshow(‘canny edges’, edged) _, contours = cv2.findContours(edged, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_NONE) cv2.imshow(‘canny edges after contouring’, edged) print(contours) print(‘Numbers of

Continue reading

What purpose does .astype("uint8") have here?

Issue (score,diff)= structural_similarity(original_gray,tempered_gray,full=True) diff = (diff*255).astype("uint8") print("SSIM:{}".format(score)) The above mentioned code is a snippet from a program that matches two images using their SSIM score. What I don’t understand here is the function of .astype("uint8"), and why are we multiplying

Continue reading