Imagic magic processing of scan images

By : Abhinay
Source: Stackoverflow.com
Question!

I am uploading a pic of document taken with my smart phone to my linux server. On my linux server i am using image magic to cut the edges and do some processing(like gray color coding) to make it look like a scanned document. Below is one sample imageenter image description here

I want to trim the image so that only the paper is selected and do further processing to make it look like a scanned image, similar to what cam scanner does. Can you please help me in achieving this.

Note: I want the parameters for image magic tool to be generic so that i can use the same command line options to process images taken under different conditions of light.

By : Abhinay


Answers

I agree with @Mark. However, I can offer a starting point that may help you get going in the right direction:

Isolate the Paper: Assuming the paper is sufficiently contrasted against the background you can use something like:

 ## make the background transparent 
 convert 'input_image' \( -clone 0 -fill black -fuzz 10% +opaque "rgb(1,1,1)" -transparent black \) -delete 0 'transp_image'

You will have to change the rgb color values to match the 'white' color of the paper. The display command in imagemagick has a nice utility for this. Also you can play with the -fuzz percentage to isolate the paper only.

Remove the Background: Hopefully the above code will make all areas outside the paper transparent in which case you can trim away the background:

 ## trim the transparent background away
 convert 'transp_image' -trim 'isolat_image'

From there you can do fancier things like changing the perspective. Try looking into -distort in imagemagick (http://www.imagemagick.org/Usage/distorts/#perspective). Though I am not sure how you would apply a distortion in a loop to pictures taken by hand -- each picture would probably require specific input parameters.

Good luck!



Don't use Bcc header for many users. Yo can make is:

Your form:

...
<input type="checkbox" name="email[]" value="[email protected]"> - [email protected]
<input type="checkbox" name="email[]" value="[email protected]"> - [email protected]
<input type="checkbox" name="email[]" value="[email protected]"> - [email protected]
...

Your backend code:

...
if (array_key_exists('email', $_POST) && is_array($_POST['email'])) {
    foreach ($_POST['email'] as $to) {
        mail($to, $subject, $message, $headers);
    }
}
...

All emails sent separatelly for all recipients. This is flexible case for your application -- you can check for each send status.

By : Deep


Why don't you create the 'click' event for the button outside the "$('label').click" event?

 $('.greyBtn').click(function() {
      $('greyBtn').removeClass('glow'); 
 });
By : AleJuliet


This video can help you solving your question :)
By: admin