image-processing

How to generate shadow under words on an image

有些话、适合烂在心里 提交于 2021-02-08 13:12:00
问题 public static System.Drawing.Image GenerateGiftCard(String text, Font font, Color textColor) { System.Drawing.Image img = Bitmap.FromFile(@"G:\xxx\images\gift-card.jpg"); Graphics drawing = Graphics.FromImage(img); //measure the string to see how big the image needs to be SizeF textSize = drawing.MeasureString(text, font); //create a brush for the text Brush textBrush = new SolidBrush(textColor); float x, y; x = img.Width / 2 - textSize.Width / 2; y = img.Height / 2 - textSize.Height / 2;

How to extract image bytes out of PDF efficiently

℡╲_俬逩灬. 提交于 2021-02-08 11:18:27
问题 Is there a way to extract image bytes out of PDImageXObject for different image types without loading them into a BufferedImage? A 15mb TIFF file takes up 200mb in memory when loaded into BufferedImage, which I would love to avoid. I have found an example for JPG files, but I have no idea what it's doing or if it's possible to do the equivalent for other file types: PNG, GIF, TIFF etc. // I don't really understand this, but it works for JPEGs private static final List<String> PDF_JPEG_STOP

How can I apply a colortable to my grayscale 8 bit image and convert it correctly in Qt?

╄→尐↘猪︶ㄣ 提交于 2021-02-08 08:56:19
问题 I would like to convert my grayscale_8 QImage to an Indexed_8 with a colortable. I found have found and tested functions that generate a colormap (MATLAB jet) accurately -- here is my code: for (double i = 0; i < 256; ++i) { double hi = 255; double lo = 0; double r = -4.0 * std::abs(i - 255.0 * 3.0 / 4) + 255.0 * 3.0 / 2; double g = -4.0 * std::abs(i - 255.0 * 2.0 / 4) + 255.0 * 3.0 / 2; double b = -4.0 * std::abs(i - 255.0 * 1.0 / 4) + 255.0 * 3.0 / 2; CP->colortable.append(qRgb(r < lo ? lo

Detect a frame with squares in corners with OpenCV.js

自古美人都是妖i 提交于 2021-02-08 08:52:06
问题 I have been playing with creating a filled form scanner with Javascript and OpenCV.js. What I basically want to do is to take a photo of a piece of paper with a filled form on it and be able to scan the photo and analyze the answers in the form. The first step is to actually find the form in the picture and apply perspective transform to get the "top-down view" of the paper. What I have done is I managed to get the script to detect the piece of paper and apply the transform to get it nicely

Image and Voronoi diagram on the same figure

丶灬走出姿态 提交于 2021-02-08 07:59:25
问题 I need to plot a Voronoi tessellation on top of an existing image using scipy.spatial.Voronoi . I have imported an image as a numpy array using matplotlib.pyplot : img_file = 'my_image.png' img = plt.imread(os.path.join(data_dir, img_file)) fig = plt.figure() ax = fig.add_subplot(111) When I display the image it works ok: ax.imshow(img) my initial image Then I want to add a Voronoi graph (for some points I choose arbitrarily) on it so I do: points = np.array([[0, 0], [0, 1], [0, 2], [1, 0],

Why I get 0s as output when I tried to calculate accuracy for image segmented result?

耗尽温柔 提交于 2021-02-08 05:07:50
问题 I checked the accuracy of a segmentation method using the bboxPrecisionRecall function in Matlab version '9.4.0.857798 (R2018a) Update 2' and test result of an algorithm using IESK-ArDB dataset. The database is freely available here. Samples of database images and . I get 0s as output when trying to calculate the accuracy. What shall I do to get real results for my segmented algorithm? The Code is below: %% clean Workspace clear; clc; %% my segmented bounding box cell propied = {[48.5,84.5

Trying to normalize Python image getting error - RGB values must be in the 0..1 range

╄→гoц情女王★ 提交于 2021-02-08 04:41:07
问题 I'm given an image (32, 32, 3) and two vectors (3,) that represent mean and std. I'm trying normalize the image by getting the image into a state where I can subtract the mean and divide by the std but I'm getting the following error when I try to plot it. ValueError: Floating point image RGB values must be in the 0..1 range. I understand the error so I'm thinking I'm not performing the correct operations when I try to normalize. Below is the code I'm trying to use normalize the image. mean

Canon SDK example for image processing

徘徊边缘 提交于 2021-02-08 03:49:37
问题 I would like to use the canon EDSDK in a c# or VB.NET program, to view cr2 files. I have found sample code on how to control the camera - example: https://github.com/esskar/Canon.Eos.Framework but nothing about opening the files, extracting the image data and displaying it - or saving the thumbs or full sized image as a jpg... Could someone direct me to some such examples ? Thank you. Note - I have EDSDK 2.12, i hope older versions could also help. Edit: Thank you for the suggestion, it

Canon SDK example for image processing

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-08 03:48:55
问题 I would like to use the canon EDSDK in a c# or VB.NET program, to view cr2 files. I have found sample code on how to control the camera - example: https://github.com/esskar/Canon.Eos.Framework but nothing about opening the files, extracting the image data and displaying it - or saving the thumbs or full sized image as a jpg... Could someone direct me to some such examples ? Thank you. Note - I have EDSDK 2.12, i hope older versions could also help. Edit: Thank you for the suggestion, it

Canon SDK example for image processing

心不动则不痛 提交于 2021-02-08 03:48:18
问题 I would like to use the canon EDSDK in a c# or VB.NET program, to view cr2 files. I have found sample code on how to control the camera - example: https://github.com/esskar/Canon.Eos.Framework but nothing about opening the files, extracting the image data and displaying it - or saving the thumbs or full sized image as a jpg... Could someone direct me to some such examples ? Thank you. Note - I have EDSDK 2.12, i hope older versions could also help. Edit: Thank you for the suggestion, it