Click here to Skip to main content
15,867,568 members
Articles / Programming Languages / VC++

Target Eye Revealed - Part 7 - The Privacy Protection Mode

Rate me:
Please Sign up or sign in to vote.
4.86/5 (9 votes)
8 Sep 2015CPOL4 min read 15.2K   9   5
Pixelating images for privacy protection while running a monitoring and surveillance software
In this article, you will see a demonstration of this concept and why the privacy protection mode is used in the Target Eye Monitoring System.

Introduction

This article is the seventh article in a series about the Target Eye Monitoring System, developed in 2000, and till 2010 when its technology and source code were sold to Secured Globe, Inc. The first article was about Target Eye's Auto Update mechanism, and how it is capable of checking for updates, downloading them when there are, installing them and running them instead of the old version currently running, all of the above, with no end-user intervention. The second article was about the Target Eye's screen capturing mechanism, and how compact JPG files are created combining a reasonable image quality and a small footprint. The third article was about the Shopping List mechanism. The fourth article is about Keyboard capturing. This article deals with the packaging used to let our Secret Agent in. In other words, how Target Eye can be used to wrap it with what we refer to as "cover story". The next (fifth) article explains how files are hidden and when, along with exposing how to reveal these hidden files. The sixth article was about a technique used by Target Eye for hiding files. (Following this article, I received many emails and comments so I need to clarify: Target Eye is a discontinued product and of course, it can never work today). The next article is about a feature which was not part of Target Eye but was developed after Target Eye was sold.

A Small Demonstration

I asked one of my dogs to have her photo taken and then tried to blur and pixelize it.

Image 1My dog Ketshop

Before (left) and after (right).

Why the Privacy Protection Mode Is Used

Target Eye technology was acquired by another company that developed a brand new surveillance system based on the Target Eye concept and technology. After the new product has been ready to market, testers in many countries around the world were hired to have their computer monitored. To comply with legal requirements and to protect their privacy, I was asked to add a layer which will be used when the software is used by the team of developers and by these testers and yet, will allow evaluating and demonstrating the new product, which has been sold to several Intelligence and law enforcement agencies. The solution was creating a new operation mode named Privacy Protection Mode. When this mode is used, all captured screens (and images / videos from the user's web cam, which is a feature added to the new software), the images of the desktop screen and the web cam are pixelized.

Saving a Pixelized Image File

In order to save a .jpg or .png image file which will not reveal any private data, we need to use some sort of pixelizing which is different between web cam images and desktop screenshot.

C++
#ifdef PRIVACYPROTECTION
    int workHeight = pBitmap->GetHeight();
    int workWidth = pBitmap->GetWidth();
    int pixelate = PIXELATE_SCREEN; //Modify here for a more/less pixelated image  >more  <less
    if (bmpSrc == BMPSource::bmpWebcam)
        pixelate = PIXELATE_WEBCAM;
    for (int xx = 0; xx < workWidth; xx += pixelate)
    {
        for (int yy = 0; yy < workHeight; yy += pixelate)
        {
            int offsetX = pixelate / 2;
            int offsetY = pixelate / 2;

            // make sure that the offset is within the boundary of the image
            while (xx + offsetX >= workWidth) offsetX--;
            while (yy + offsetY >= workHeight) offsetY--;

            // get the pixel color in the center of the soon to be pixelated area
            Gdiplus::Color colr;
            Gdiplus::Status st = pBitmap->GetPixel(xx + offsetX, yy + offsetY, &colr);
            if (Gdiplus::Status::Ok == st)
            {
                // for each pixel in the pixelate size, set it to the center color
                for (int x = xx; x < xx + pixelate && x < workWidth; x++)
                    for (int y = yy; y < yy + pixelate && y < workHeight; y++)
                        pBitmap->SetPixel(x, y, colr);
            }
        }
    }
#endif

There are two predefined values:

#define PIXELATE_SCREEN  5
#define PIXELATE_WEBCAM     25

I have found that with these values, the images captured by both web cams (front and back) don't reveal the person in front of the camera, while when it comes to screenshots, the web cam value will create a "too pixelized" images, so this value is much lower.

Alternative Methods

During the research, we hired several experts who came up with some alternative methods for "blurring" the images.

Image 3

A webcam image captured during a flight by the software installed on my Surface Pro 3

After using the Blur effect, the differences are shown in the next image:

Image 4

Here is how that is done:

C++
void Blur(HBITMAP &blurBmp, HDC hdcBlur)
{
    // Blur ==================================================================
    double Ax = 0;
    double Bx = 1.0 / 8.0;
    int Nx = 1;
    // Transform Matrix
    int matrix[3][3];
    matrix[0][0] = 1;
    matrix[1][0] = 0;
    matrix[2][0] = 1;
    matrix[0][1] = 0;
    matrix[1][1] = 8;
    matrix[2][1] = 0;
    matrix[0][2] = 1;
    matrix[1][2] = 0;
    matrix[2][2] = 1;

    SelectObject(hdcBlur, blurBmp);
    for (int i = 0; i < 120; i++)
    { 
      for (int j = 0; j < 100; j++)
        {
            double Summ[3];
            for (int k = 0; k < 3; k++)
                Summ[k] = Ax;
            // Calculate matrix transform   
            for (int k = -Nx; k <= Nx; k++)
                for (int l = -Nx; l <= Nx; l++)
                {
                    COLORREF color = GetPixel(hdcBlur, i + k, j + l);
                    int mx = matrix[1 + k][1 + l];
                    Summ[0] += GetRValue(color) * mx;
                    Summ[1] += GetGValue(color) * mx;
                    Summ[2] += GetBValue(color) * mx;
                }
            for (int k = 0; k < 3; k++)
                Summ[k] = ColorRange((int)round(Ax + Bx * Summ[k]));
            SetPixel(hdcBlur, i, j, RGB(Summ[0], Summ[1], Summ[2]));
        }
    }
}

Software  

Other Types of Data That Can Be Masked and How

I have included one of the many types of methods for hiding and masking private data, and needless to emphasize how privacy is important, especially when dealing with monitoring remote computers.

Here are some Privacy Protection methods used by the new product:

Masking Passwords

Instead of "open123" the software stores "*****". Usually the entry name will be kept, but the password will be masked. That creates a balance between the ability to measure the performance and efficiency of the software and the privacy of the testers.

The Shopping List Mechanism

When the Shopping List mechanism is used in Privacy Protection mode, instead of fetching privacy files and sending them to the server, a "dummy" file is generated. This file has the same type (extension) but contains just test data.

Emails

The software keeps the email's subject untouched and mask the email's body, other party's name and in case of attachments, the software takes similar actions as the Shopping List mechanism, replacing the attachments with "dummy" files.

History

  • 8th September, 2015: Initial version

Michael Haephrati , CodeProject MVP 2013

©2000-2016 Target Eye LTD (UK)

All materials contained on this article are protected by International copyright law and may not be used, reproduced, distributed, transmitted, displayed, published or broadcast without the prior written permission given by Target Eye LTD (UK). You may not alter or remove any trademark, copyright or other notice from copies of the content.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
CEO Secured Globe, Inc.
United States United States
Michael Haephrati is a music composer, an inventor and an expert specializes in software development and information security, who has built a unique perspective which combines technology and the end user experience. He is the author of a the book Learning C++ , which teaches C++ 20, and was published in August 2022.

He is the CEO of Secured Globe, Inc., and also active at Stack Overflow.

Read our Corporate blog or read my Personal blog.





Comments and Discussions

 
Questionunpixelellate? Pin
dommy1A9-Sep-15 2:49
dommy1A9-Sep-15 2:49 
AnswerRe: unpixelellate? Pin
Michael Haephrati9-Sep-15 2:51
professionalMichael Haephrati9-Sep-15 2:51 
I don't know about a way to reverse it. If there was, the privacy protection was pointless (as the person who have had access to such "pixelized" image could have just reverse it...).
- Michael Haephrati מיכאל האפרתי

GeneralRe: unpixelellate? Pin
dommy1A9-Sep-15 2:57
dommy1A9-Sep-15 2:57 
GeneralRe: unpixelellate? Pin
Michael Haephrati9-Sep-15 3:19
professionalMichael Haephrati9-Sep-15 3:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.