image-manipulation

Using PIL's ImageDraw Module

巧了我就是萌 提交于 2019-12-10 14:58:11
问题 I'm trying to do individual pixel manipulation using PIL's ImageDraw Module. The code bellow is supposed to create Tkinter canvas widget. Then open an image, change one pixel's color to red, then embed the image in the canvas widget. However, it doesn't seem to be working. My Code: import Tkinter from PIL import ImageTk, Image, ImageDraw class image_manip(Tkinter.Tk): def __init__(self): Tkinter.Tk.__init__(self) self.configure(bg='red') self.ImbImage = Tkinter.Canvas(self, highlightthickness

Image cropping C# without .net library

♀尐吖头ヾ 提交于 2019-12-10 14:21:05
问题 Can anyone advise on how to crop an image, let's say jpeg, without using any .NET framework constructs, just raw bytes? Since this is the only* way in Silverlight... Or point to a library? I'm not concerned with rendering i'm wanting to manipulate a jpg before uploading. *There are no GDI+(System.Drawing) or WPF(System.Windows.Media.Imaging) libraries available in Silverlight. Lockbits requires GDI+, clarified question Using fjcore: http://code.google.com/p/fjcore/ to resize but no way to

How to display resized images on a web page while maintaining aspect ratio?

喜欢而已 提交于 2019-12-10 13:49:31
问题 What is the best and quickest way to resize images on the client side using JavaScript? EDIT: Sorry, I meant the best way to display an image resized on the client side.. 回答1: Easy. <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Client-Side Image Resize (Why?!)</title> <script type="text/javascript"> window.onload = function() { var url = "http://www.google.com/intl/en_ALL/images/logo.gif"; var img = new Image(); img.onload = function() { var w = parseInt((this

how to sketch a polygon in a matrix or binary image in order to use image processing functions?

微笑、不失礼 提交于 2019-12-10 12:56:21
问题 I'm developing a matlab program in which I uses polygons(concave or convex). I need to use image processing functions like imdilate or imerode and etc on the polygons. To this end, I should convert my polygons to image. I wonder whether there is a way to sketch a polygon directly in a binary matrix (1's for foreground and 0's for background) ? Currently, I use 'getframe', then 'frame2im 'and then 'im2bw' functions to do so. but its drawback is that I have no control on the size of the final

need ideas to only display some pixels and gray out the remaining pixels

可紊 提交于 2019-12-10 11:35:25
问题 I'm looking for ideas ...brainstorming a new project for a client ....I have an image ...300px x 300px ...I need to display the image one random pixel at a time until the entire image is revealed. Basically, at certain intervals, a pixel is revealed and remains revealed while other pixels are still blank. At each interval, another pixel at random is revealed and remains revealed to join the other revealed pixels. Eventually, all the pixels will be revealed. Any suggestions on how to make that

Resize and compose two or more images using gm in Nodejs

懵懂的女人 提交于 2019-12-10 10:08:06
问题 Given two images, say under img (in size of 1024x768) folder (img1.png and img2.png), I need to resize img2 (say 300x300) and put on img1 in x and y (say 100, 200) from top left of img1. The end result should be 1024x768 size image. Using gm (https://github.com/aheckmann/gm), tried this: gm('./img/img1.png') .composite('./img/img2.png') .geometry('300x300+100+200') .write('resultGM.png', (err) => { if (err) console.log(err); }); Expectedly (because of chain on whole operation) it produces

Make an image's background transparent or white programmatically

白昼怎懂夜的黑 提交于 2019-12-10 09:54:20
问题 If one is creating an application in which one would like to make the " background " of an image transparent or white, is there a way to do this? For example : In the image, http://upload.wikimedia.org/wikipedia/commons/b/b9/Bronze_Statuette_of_a_Veiled_and_Masked_Dancer_1.jpg , I would like to transform the image programmatically, such that only the statue remains, and the background (i.e. the rest of the image) is all white, or transparent. Also, the user might point out to the part of the

Getting a incorrect picture output when running my self-made rotation algorithm

我怕爱的太早我们不能终老 提交于 2019-12-09 21:52:58
问题 In order to better understand how image manipulation works, I've decided to create my own image rotation algorithm rather than using cv2.rotate() However, I'm encountering a weird picture cropping and pixel misplacement issue. I think it may have something to do with my padding, but there may be other errors import cv2 import math import numpy as np # Load & Show original image img = cv2.imread('Lena.png', 0) cv2.imshow('Original', img) # Variable declarations h = img.shape[0] # Also known as

How can I convert between RGB565 and RGB24 image formats in MATLAB?

自作多情 提交于 2019-12-09 17:00:45
问题 I am getting an RGB matrix from a microprocessor that outputs an image in RGB565 format. I want to read this into MATLAB, convert it to RGB24 format, and output the image. How do I do this? 回答1: You first have to read your data from the text file into a matrix in MATLAB. Since I don't know what format your text file is in, I can only suggest that you will probably need to use the function fscanf to read in all of your values (probably of type uint16), then you will likely have to reshape the

Positioning image on Google Maps with rotate / scale / translate

眉间皱痕 提交于 2019-12-09 12:22:42
问题 I'm developing a user-interface for positioning an image on a google map. I started from : http://overlay-tiler.googlecode.com/svn/trunk/upload.html which is pretty close to what I want. But instead of 3 contact points I want a rotate tool, a scale tool and a translate tool (the later exists). I tried to add a rotate tool but it doesn't work as I expected : I put a dot on the left bottom corner that control the rotation (around the center of the image). The mouse drag the control dot and I