Image Tamper Detection

hi guys.

I am working on a project which requires me to determine whether a given image is an original camera ouput or it is morphed in any which way.

I am supposed to use Matlab for the project(Image Processing Toolbox).

I have done extensive research on the internet.

The problem i am facing is that, all the articles i find require me to make use of the original image. But then, having the original iamge is a very rare case.

Can somebody with any relevant info guide me a little .

Any help will be highly appreciated.

Specifically, if anybody knows links which help in image authentication WITHOUT USING ORIGINAL IMAGE, please reply.

Thanks again.

Replies

  • xheavenlyx
    xheavenlyx
    I am working on a project which requires me to determine whether a given image is an original camera ouput or it is morphed in any which way.
    You said it your own words, weather a GIVEN image is original or not, and then below you write.. "Having the original is very rare."

    I really did not understand your problem. Better give an example how you use this and where.

    Do you actually mean?
    1. Take image from camera.
    2. See if it is un-modified?
    3. If it is modified..and so on.
    But how can image from the camera be modified?? Since you are directly taking the "orignal". All are un-modified by default.
  • hbk
    hbk
    Firstly, thanks for a prompt reply.

    what i actually meant was--- you are provided with an image. It is not known as to whether the image is an original camera output or it has been modified/tampered.

    You are supposed to determine the authenticity of the image, and also , if the image is found to be a tampered one, we have to determine the region of the image where tampering has taken place.

    Please reply even in case it is not clear. I shall explain it in more detail.
  • xheavenlyx
    xheavenlyx
    wow, ok, nice one ๐Ÿ˜€

    Well, I cannot answer this really soon, but I have worked with Matlabs Image Toolbox. So we can try some ideas here...lets see...

    There are several considerations here:

    1. It is NEARLY impossible (not 100% impossible i guess) to find out if an image is tampered with just by looking at the physical structure (Analyzing pixels). this is because present day photo editors are very very good!! ๐Ÿ˜€

    2. One way is to look at the raw file header. Because if the image is taken by a commercial camera then the file itself .jpeg or .raw or anything will have information inside the file which a user cannot normally access. This place also has information on DATE, TIME last modified and also CAMERAMODES. So this is a good place to look if its been edited after been taken.

    3. I know for sure, after editing a picture with Photoshop, the file header will contain a signature from Photoshop, and a date (i think). So you can also know it from there if it has been edited.

    Now as for MATLAB analyzing the actual pixels...

    I dont think you can know...cuz how can I know if a newly opened box contained 4 appels or someone opened it and removed 5...or if it was opened at all, or even if I know someone opened it, how much they have taken? Again, this is one argument:

    However(!), in some types it can be possible. For example, you have a security camera which takes only one picture of a place which has constant color lighting. If this is the case then we can use MATLAB to analyze a portion of the image and calculate pixel changes. This heavily depends on your image and color scheme used. since some color schemes are difficult to modify and replicate. So you can know which part of the image has the highest variation of changes!

    Here are some operations (some ways, you can make your own too) that can be performed on an image:

    Morphological Operations:
    These are Image Processing operations done on binary images based on certain morphologies or shapes. The value of each pixel in the output is based on the corresponding input pixel and its neighbors. By choosing appropriately shaped neighbors one can construct an operation that is sensitive to a certain shape in the input image.

    a) Bridge - bridges unconnected pixels.
    b) Clean - removes isolated pixels.
    c) Fill - fills isolated interior pixels.
    d) Majority - sets a pixel 1 if five or more pixels in 3x3 neighborhood are 1โ€™s.
    e) Remove - removes interior pixels by setting pixels to zero if its 4 neighbors are 1, thus leaving only boundary pixels on.
    f) Shrink - shrinks object to a point.
    g) Diagonal Fill - fills diagonal elements to eliminate 8 connectivity with background.
    h) Skeletonize - It creates skeleton of an object, by removing pixels on the boundaries but does not allow objects to break apart.
    i) Dilation - if any pixel in the input pixelโ€™s neighborhood is on, the output pixel is set otherwise cleared. It removes the small holes in the object.
    j) Erosion - if every pixel in the input pixelโ€™s neighborhood is on, the output pixel is set otherwise cleared. It results in shrinking the objectโ€™s area, thus small isolated regions disappear.





    If you are really unsure, give me an original image and a modified, I will try writing a MATLAB algo for it..
  • hbk
    hbk
    well i've done a lot of reading online regarding this.... and there isn't a single link i found which provides a method of tamper detection using just the one image.....

    and also, the argument you gave about the apples and boxes seems pretty logical.... i mean, unless u know what something is supposed to be like, how can u decide whether it is right or wrong....

    so can we say(with almost 100% surity), that we require the original image and the (image to be tested) for any sort of analysis???
  • xheavenlyx
    xheavenlyx
    Exactly, but we can say that with 90% surety, because in certain situations it may be possible to find if the image has been tampered with. In an image where you "Already know" what color codes you are using.

    Like in a place where you have taken a picture with certain shades of red embedded in the image...you know how much is added. So if someone tried to change the color with photoshop, it WILL certainly introduce new shades of red. Again here you do need information of previous image (but not explicitly the actual file...just some math formulas you know were applied to your originals before hand).

    Hope you have understood, and this discussion has helped! ๐Ÿ˜€
  • coolsank
    coolsank
    have u thought about steganography..??

    Steganography
  • xheavenlyx
    xheavenlyx
    Thanks for that information coolsank!! I didnt know its called Steganography!

    Yea, this is probably a good method for hbk's use too. If hbk is writing a report he can include all this information ๐Ÿ˜€

    bytheway, if possible do thank crazyengineers in the Acknowledgments! ๐Ÿ˜€
  • hbk
    hbk
    i have read abt steganography also.... its different from tampering.... steg. i guess is abt info hiding in the image and is used for security purposes... correct me if i m wrong....
  • elric
    elric
    Your problem is quite difficult to solve. Its like trying to measure a physical value without a reference. For measuring anything and making logical sense of it you will need a reference, in this case the reference would be your original image. Thats why i guess there arent any methods to check the authenticity of an image using a single image as is. Cause the level of authenticity cant be measured using any filtering or such operations applied to just a single image as you dont have anything to compare it with ๐Ÿ˜›.
  • hbk
    hbk
    i talked to a few friends who are into photography.....

    they suggested that in case i hav just the 1 image, what i can dop is to check for the continuity of a number of features in the image.... coz in a natural untampered image, all features are in a cntinuum..... no drastic variations...


    eg. i can check for continuity of sharpness, brightness, and other such features....


    but this isnt foolproof, is it?? i mean, dpoesnt it depend on the lack of skill of the person doing the tampering.... the more skilled he is, the more difficult the detection.... wat say???
  • elric
    elric
    yea, the technique your friends suggest is quite flawed, for an untampered image may also have a drastic variation, say in brightness if there are some metallic glare
  • xheavenlyx
    xheavenlyx
    Exactly as Elric said, and my above post. Its not possible, unless they guy is modifying the picture using Microsoft Paint.

    Your best bet it to have your originals made in a way that only you know the brightness and stuff continuum (unless you are doing tamper detection on many other sources of which you have no idea of the original)

    Secondly, You can "visually" try to see the changes with your own eyes! Much better if used in combination with MATLABS feature extraction etc...
  • maurits
    maurits
    I know two basic approaches to do this. The first method processes the suspect image region by region and looks for similarities that might have been caused by the 'cloning' tool, or coping image regions.

    Have a look at the paper by J. Fridrich, '#-Link-Snipped-# with D. Soukal and J. Lukรƒยกร…ยก'

    The other, and probably more difficult approach is the following. A digital camera with a sensor with a so called bayer pattern, only measures R, G or B values per cell. That means that per RGB pixel, there are two missing values that need to be interpolated. This is also called demosaicking. There are various algorithms do to this, but the key idea, is that interpolated pixel values are related to each other. A relation that might be disrupted by image tampering.

    Everything and more on this subject can be found at the university of #-Link-Snipped-#.
  • Ashraf HZ
    Ashraf HZ
    Whoa.. this is interesting stuff!

    I don't know much about image processing, but you also have to remember that random noise will invariably affect the picture too. So its quite hard to know if variations are caused by deliberate morphing or noise.

    Is it possible to take pictures and output it as vector images? I bet that will take a lot of resources and mathematical power to do so ๐Ÿ˜› The picture would have to be taken by a special camera or something.. but it would still be cool nonetheless!
  • xheavenlyx
    xheavenlyx
    There are various algorithms do to this, but the key idea, is that interpolated pixel values are related to each other. A relation that might be disrupted by image tampering.
    Ohhh man, this is a really cool idea!!! The interpolated pixels will have a mathematical relation with their immediate neighbor!

    The link you have given is invaluable to this discussion!!

    And ash, yea noise will effect a picture and must be considered in ALL our assumptions.

    As for vector thats a good idea ๐Ÿ˜€ and i have no idea how it would be possible.
  • Kaustubh Katdare
    Kaustubh Katdare
    xheavenlyx
    Ohhh man, this is a really cool idea!!! The interpolated pixels will have a mathematical relation with their immediate neighbor!

    The link you have given is invaluable to this discussion!!

    And ash, yea noise will effect a picture and must be considered in ALL our assumptions.

    As for vector thats a good idea ๐Ÿ˜€ and i have no idea how it would be possible.
    [spam] He's an 'Imaging' engineer! Did you notice that?! [/spam]
  • Ashraf HZ
    Ashraf HZ
    Oh yea, I just realised that! Thats a cool title ๐Ÿ˜‰

    Slightly offtopic, I realised that stating your specialization to others will make for a good topic for discussion. Everyone (that is, non-engineers) knows what mechanical, electrical, electronics, communications, computer or chemical engineer, etc are, because they can visualise a "product" or "device" that relates to the discipline. Examples include a Car, plane, petrol.

    But if you say your an instrumentation, control or in this case an Imaging engineer, they will be like.. "WOAH.. that sounds so awesome. So what exactly do you do??" And try to visualize the latest gadget or something.

    Okay, I'm jealous. So what ๐Ÿ˜›
  • xheavenlyx
    xheavenlyx
    Oops...

    Nice to see a professional here ๐Ÿ˜€

    (Maybe a professor!?)
  • hbk
    hbk
    hi.

    if anybdy has any links related to "detection of tampering in images",which can be implemented using MATLAB, please post them here...

    any help will be highly apprecited..

    thx...
  • xheavenlyx
    xheavenlyx
    well i've done a lot of reading online regarding this.... and there isn't a single link i found which provides a method of tamper detection using just the one image.....
    Umm, i thought everything was cleared already. Want more links?
  • Mayur Pathak
    Mayur Pathak
    May be I'm joining this discussion a bit late. Some more on the Images, I'm working for the same industry right now.

    As a picture is taken by the original instrument, it is coded in RGB or CMYK values. So depending upon the capacity of the lenses, the quality of the image is determined by how many pixels are stored in a given small area. Better the lenses, more is the density of pixels meaning the resolution of image is very high. So as maurits said, there is a correlation between two adjoining pixels, who are interpolated. Such is the sequence that no two cameras can produce images with identical RGB coding.

    Now coming to tampering- One of the simplest way is to study the hidden metatags, if you know how to do that. (Psst, I don't know). The image is automatically meta tagged whenever it goes under a machine. You can also check if image was even opened in an image editing software, forget tampering.

    If some one is smart enough to delete the meta tags, and if you know how to write an algorithm who will determine if there is a mismatch between the RGB values of interpolated adjoining pixels, you catch your thief.
  • hbk
    hbk
    hey... this metatag concept seems to be useful... would you mind explaining it a bit more..any relevant links you may have are also most welcome...

    thx a lot...
    cheers...
  • xheavenlyx
    xheavenlyx
    NOTE: This is a long post so, its better if you leave this for reading when you have time. This is an interesting topic ๐Ÿ˜

    Thanks for the input mayur. ๐Ÿ˜€ Now this is an interesting part. To get the meta data (or header info for image files), as I had said in one of my previous post, this is one of the easiest way to determine tampering.

    However remember, if you do not have the original then you might not even know what the original meta data was to compare with. But anyway, here is a way to look into the meta data.

    Actually, its pretty easy after the first time (and this is just for a look, for in-depth header stuff download a program to do that...given at end).

    Pre-requisites:

    1. A hex editor: #-Link-Snipped-#
    2. Small or medium sized images (<1MB) for test like a JPEG, BMP or TIFF.
    3. Some basic interest and curiosity.

    Step 1:

    Find out what image format you will be working with.

    BPM, JPEG, PING, TIFF, etc.... or RAW (digital camera type uncompressed)

    Step 2:

    For example its a JPEG image, you can go online and search "JPEG Header Information", likewise for other formats.

    Here is a link for the header information for JPEG files: #-Link-Snipped-#
    and #-Link-Snipped-# (you can download a program from here to see your header information)

    So, ok I have opened the Hex editor, here we use HxD and loaded the image file:

    #-Link-Snipped-#


    As you can see, the first byte stands for Start of Image (SOI). This can go on like that...you can download a third party software to read the meta data from the files as there are many many formats and as you see, somewhere along it also says, Exif as readable text. So there you know its a format from JPEG/Exif and a google search reveals that most modern digital cameras use this format to tag their images.

    Ok, Take a look down about 10 lines...

    "SONY..DSC-W70.H.......H.......2008:04:23 01:12:58.PrintIM.0300..."

    Gives you the camera! and the Date and blah blah. You should read the given links for more info on other header byte markers. there are about 1600 Exif markers probably relating to different cameras and all, but some online software can do this easily. I may write one in Python too if I get a good reason heheheee.

    All JPEG files end with the bytes FFD9.


    Step 3:

    Download a good progie to get this meta data as my head is going to explode after writing this half-tutorial.

    This one seems good: #-Link-Snipped-#

    Step 4:

    Here is the screen shot of its hex dump after I edited just one pixel with MS Paint.

    Paint saves it in JPEG File Interchange Format (JFIF).

    #-Link-Snipped-#









    ===================================

    Extra Step 4:


    Here a few links:

    #-Link-Snipped-#

    #-Link-Snipped-#
    (Digital camera Formats header info)

    Simpler Exif explaination: #-Link-Snipped-#

    Exif

    And not surprisingly...How to edit Exif data (to fool you into thinking it wasnt edited(?): Exif Jpeg header manipulation tool
    ==========================================
  • CastaliaLabs
    CastaliaLabs
    we can detect doctored .jpeg images by analyzing the histogram of dct coefficients.

    I recreated the paper in the link


    Detecting Doctored JPEG Images Via DCT Coefficient
    Analysis

    Junfeng He1 , Zhouchen Lin2 , Lifeng Wang2 , and Xiaoou Tang2
    Springer-Verlag 2006

You are reading an archived discussion.

Related Posts

So, today is Friday the 13th. What's your plan for today? ๐Ÿ˜’
Its official now! Google Press Center: Press Release Yahoo & Google have joined hands. Yahoo will now use Adsense for search & Adsense for content! This deal is supposed to...
Folks @ opera have finally done it. Version 9.5 is now available for download: Opera browser Let's give it a try! ;-)
hi.. Could anybody please tell what excatly is the difference between B.E and B.Tech.....I know both are simply know as engineering.....but what is the reason they both have different names???any...
Can anybody let me know i am having Bootskin files but when i m trying to boot my system it is not opening with those files. Can aanybody suggest me?...