Raphael.js free transform image and save - service

I have a project that will require free transforming an object like this ( http://alias.io/raphael/free_transform/ ) except with an image (png). After the image is manipulated, I will then need to send the image to a web service using AJAX Post. Can anyone help with an example?

Raphael is not designed for images processing, really. I would suggest that you store the parameters the user chooses (the rotation, scale, etc.) and then apply them to the original image in plain javascript. If you stick to affine transformations, it would suffice to store the positions of the four corners of the image and apply, e.g., bilinear interpolation. Or even better: send the parameters and the image back to the server and do it there.

Related

Delphi - How to make a PNG image the main form?

I have an application which the main form of it its called Fmain. How can i make the Fmain to be the PNG image which i have as Image1 assigned in my source?
FMain.brush.bitmap:=Image1.picture.bitmap;
that's for if the Image1 is a *.bmp one, but i need the transperancy of my PNG file.
I don't think you will be able to make a custom shaped TForm with a transparent png.
Have a a look at this answer Irregularly shaped forms and more specifically to this http://docwiki.embarcadero.com/Libraries/XE2/en/Vcl.Forms.TCustomForm.TransparentColorValue .
Are you wanting to make a form that has an odd shape? As in, you want to have the transparent parts of the PNG not be clickable as a form? If so then you are going about it the wrong way. If you were to put an image on the form and set the transparent properties on the image, then all you will do is see the form behind the image.
If you want to have a form that is the shape of the visible area of the PNG then you need to create an oddly shaped form. This is done by using regions and SetWindowRgn.
Luckily there is a handy tool out there for this: Gabes OddForm Assistant. I have used this to great effect a number of times.
In order to use it you will need to save your PNG as a bitmap and then load it into the utility. Once it is done it will give you the code required to make the form. You can just have a look in the pas file it creates and see how it is done, tinkering if you feel the need. You can either use the form directly or graft the code to where you need it.
Hope this helps.

Human Detection using edge detection

I am trying to detect exact silhouette of human body in this dataset using background subtraction. After doing some thresholding I was getting split blobs so I looked at this tutorial by Steve but now I am getting blob other that human body as shown below
So here is the original
After Subtracting it from background, background was considered as the first frame of the video, so after subtracting it from orignal image I get the following image
so I did basic thresholding and I get the following image, which is split from further areas
and using Steve's method I get this
But this contains a lot of area which is not a part of human body, any suggestion if somehow or using edges I can get good blob of human body.
EDIT
As #lennon310 asked me to upload color image so here it is
and as #NKN asked me to upload edge information of the same image so here it is
Instead of literally subtracting the background, try using the vision.ForegroundDetector object, which is part of the Computer Vision System Toolbox. It implements the mixture-of-gaussians adaptive background modeling, and it may give you a cleaner segmentation.
Having said that, it is very unlikely that you will get the "exact" silhouette. Some error is inevitable.
In your result image, you have tow types of black regions. one is moving and the other is stationary.
So when you you want to fill the human body, you have to choose only the moving region, for this purpose, I suggest to segment your image by adding optical flow technique to know where the moving regions are.
This is an interesting tutorial doing what you need to do:
http://docs.opencv.org/trunk/doc/py_tutorials/py_video/py_lucas_kanade/py_lucas_kanade.html

How do make an automatic cropping for the interest area in MATLAB?

I'm the beginner of image processing by using MATLAB and i have to do some tasks, i want to crop or cut for the specific area like using imcrop but want to make it automatic (i cannot upload picture because i'm the new user, the picture that i use is the cross-section of a plant) i really don't know how to detect and cut out only that area. I'll really appreciate if there's someone can help me to figure out this problem.
You need to give us more information. If you want to automate the detection of a part of an image to crop it, you need to do some image processing. What kind will depend on the characteristics of your images and the part you want to crop.
You can post an image using, for example, http://www.postimage.org/

How can I process an image to remove a watermark within my iPhone application?

I want to remove watermark from a picture within my iPhone / iPad application. Is there any kind of image processing I can perform within this application to do this?
Can't be done, sorry.
The watermarked image were originally two images (the base and the watermark), which were merged together to form the result. The problem here is that the most common image formats (such as JPG, PNG, or GIF) have no concept of layers - so that the base would be one layer, and the watermark another: the result is just one layer, onto which both were redrawn. This is somewhat similar to a physical painting: if you paint one image on a paper using watercolors, and then another over the same spot, their colors will mix and you won't be able to tell which parts belong to one or the other, as they'd become a single image.
This is similar with the computer image formats: there is only one "layer", which for every pixel encodes exactly one color that is there - only the current color exists, and the image doesn't keep track what was on that pixel before.
Now, the information is irreversibly lost from the result - in other words, it is not possible to recover the base knowing just the result (or the result and watermark) - BTW, that's exactly the point of watermarking.
I have borrowed the image sprites of StackOverflow for a demonstration; the actual images used are not unique, the technique would work just as well with any images. This was the watermark I used:
And this is the result image, after merging with the base:
Now, even though we have the exact watermark image used, there's no way to recover what was underneath that star in the original image. Through image processing operations, we could almost remove the star from the result, but there's not enough data to tell us what used to be underneath: - that information got erased in the merge at the beginning.
We could guess what used to be there, but then we're not doing recovery any more, we're interpreting the image and guessing what possibly could have been there - and that's pretty hard, even for a human; computers are really bad at that. This is the original image, before I watermarked it - I bet you were expecting something slightly different, no?
The watermark is almost certainly part of the image. (The only case in which it wouldn't be is something like PDF or SVG, where it could be a separate vector element.)
Watermarks are typically present on images for purposes of managing intellectual property; if one has licensed an image for a particular use, typically one will receive access to a version of the image without a watermark. Thus wanting to "remove watermarks" is also likely to be treated as highly suspicious.
Watermarks are part of the image, there isn't going to be a magic way to remove them and recover the missing pixels in any tool.
Take a look at the source! Most or the current watermarking is done in php as an automated script. In most cases you will see the base picture in source

iPhone, how do you draw from a texturepage using coregraphics?

I'm trying to work out how to draw from a TexturePage using CoreGraphics.
Given a texture page (CGImageRef) which contains multiple 64x64 packed textures, how do I render sub areas from that page onto the device context.
CGContextDrawImage seems to only take a destination rect. I noticed CGImageCreateWithImageInRect, however this creates a new image. I don't want a new image I simply want to draw from the original image.
I'm sure this is possible, however I'm new to iPhone development.
Any help much appreciated.
Thanks
What's wrong with CGImageCreateWithImageInRect?
CGImageRef subImage = CGImageCreateWithImageInRect(image, srcRect);
if (subImage) {
CGContextDrawImage(context, destRect, subImage);
CFRelease(subImage);
}
Edit: Wait a minute. Use CGImageCreateWithImageInRect. That is what it's for.
Here are the ideas I wrote up initially; I will leave them in case they're useful.
See if you can create a sub-image of some kind from another image, such that it borrows the original image's buffer (much like some substring implementations). Then you could draw using the sub-image.
It might be that Core Graphics is intended more for compositing than for image manipulation, so you may have to use separate image files in your application bundle. If the SDK docs don't particularly recommend what you're doing, then I suggest you go that route since it seems the most simple and natural way to do it.
You could use OpenGLES instead, in which case you can specify the texture coordinates of polygon vertices to select just that section of your big texture.