Loading...
Logo
Processing Forum
Some friends at work want to develop an in-and-out tracking program. Now you can use any programming language you prefer.

I want to use processing however I want to access the database using sql and also store the data in images using the pixels.

I know basic SQL but how can I develop an algorithm to search the images based on specific criteria ?


Example

Database name : Employee.dbf
Name : Owaun
Age : 33
Occupation : Computer Programmer
Location : In_house

A basic sql is
Select * from employee where Location = "in_house"

How would it best to develop an algorithm to search images where this data is stored ?

Any ideas?



Replies(10)


also store the data in images using the pixels.
That doesn't make any sense.


 
also store the data in images using the pixels.
That doesn't make any sense.

Something like the below
Copy code

  1. PImage ax;
    void setup(){
      size(255,255);
      ax = createImage(255,255,ARGB);
      loadPixels();

      //Date 2010-12-03
      //pixel value
      //pixels[0] red 20 green 10 blue 12 green 03
      ax.pixels[0] = color(20,10,12,03);
      color pickdate = ax.pixels[0];
      println("Date : "+_fr2(pickdate)+_fg2(pickdate)+"/" +_fb2(pickdate) +"/"+(int)alpha(pickdate));


      String program = "Processing";

      for (int i = 0;i<program.length();i++){
        pixels[i+1] = color(program.charAt(i),255,255);
        print(klip(pixels[i+1],"r"));
        //println(char(byte(_fr2(pixels[i+1]))));
      }
      println("");

      for (int x=1;x<11;x++){
        ax.pixels[x]=pixels[x];
      }
      image(ax,0,0);
      save("testrun.png");
    }


    color _fr2(color colx){
      return  colx >> 16 & 0xff;
    }
    color _fg2(color colx) {
      return  colx >> 8 & 0xff;
    }
    color _fb2(color colx){
      return    colx  & 0xff;
    }

    String klip(color val,String base){

      String retval = "";
      if (base=="r"|| base == "R")retval =str(char(byte(_fr2(val))));

      if (base=="g" || base == "G")retval =str(char(byte(_fg2(val))));
      if (base=="b" || base == "B")retval =str(char(byte(_fb2(val))));
      if (base=="a" || base == "A")retval =str(char(byte(alpha(val))));
      return retval;
    }


Just a basic way to store data in an images for later use.


but again, doing this makes no sense... it's like..... no...
This doesn't make it in any ways easier to read or write data, in fact it just complicates things.... i'm just speechless...
Well, the idea is amusing, but databases work best with strings (or numbers), not with pixels...
Thanks guys.
 
The guys at work agree with you. They don't get the idea of why would you use pictures to store data as well.
 
I am targetting smart devices, basically any pixel array capable device.
 
Databases are raw text however are displayed after sql querying. My premise is, if the data is already a picture then the transition is more seamless in terms of processing whereas you are not storing a bit of text but a pixel of data. This data is compounded so I can store four files in one document.
 
I have a working theory using emoc's website.
 
One Processing script loads the openprocessing sketch and saves it as a picture. Then another processing sketch can read that picture and then re-output the text. The beauty of it that I can create any encryption method along the way and even store in the same very image wherein the image can be used to decrypt itself.
 
The possibilities are endless which is Processing's main attributes.
 
For Example.
 
We all post snippets of code on these forums. Also there is a ton of code in the old alpha forums. These snippets of code can be stored in images and that increases their mobilty and archiving value. Not to talk about compactibility. Four (4) text files at 2kb each is 8kb. With this method you can have one compact file of approximate 6kb. This works both ways. You can have one file with the top layer as  black and white 2d drawing, drop down the next level the dimensions, drop down another level you can store let's say icons. You still have the alpha channel to store whatever you choose.
 
Basically I like the idea because it gives you choice in a digital world where the basic software we are all using is a browser which all it is doing is parsing a text file on a server somewhere.
 
Do we surf the web looking at text only sites. Basically we do (under the hood) What those text files refer are images. This in turn results in what we call content.
 
The ultimate goal of this technique I want to develop is a sychronized layerered information development environment, where persons can exchange images and data seamlessly with out the limitations of whatever devices they are using.
 
Basically creating a digital software environment where the rules itself creates the freedom and environment as if the rules don't exist. The rules are they to create freedom.
 
Processing - possiblities abound - choose one.
but again this makes no sense whatsoever, it is as if you are totally lacking the understanding of how files, compression, arrays and even bytes works.
Like phi.lho said, the idea is amusing but you're taking it too serious or maybe even misunderstands it. This sounds like a total waste of time.
When I first came up with it was very hard for me to conceptualize as well so I sorta understand you guys having difficulty wrapping your heads around it.

This may help.

If you want to store an image in a SQL database you simple store the location of the image on the server in the database and once your php script loads the link the image is displayed. The images does not have to be physically in the sql database.


I am doing the same thing but with pixels. Also, when we want to post youtube links or even vimeo, the image  or video is not physically on these forums.. you are just providing access to the data. The same is with email. You send and email and you send attachments. If you send a youtube link in a gmail email , gmail parses the email and gives you the youtube window at the base of the email.

I am not a fan of Objective C. I am a fan of Processing and processingjs. Which coincidently is very in synch with HTML5 canvas. The idea of using images to store data is very possible once you have decent enough parsing algorithms which is what browser do anyway (parse text) The .html file does not have the image embedded in it. It has a link to the image.

I am doing the reverse, the image has the html embedded in it and once its an image, any pixel array device can access it.


I think what I will have to do is create a proof-of-concept sketch that has images, which contain html-like processes and the application loads the images and the user can work with a web like application.

I'll try to keep it as simple as possible. The problem (sarcasm) with Processing is that you start to create a simple idea of proof of concept and the darn thing turns out wayyy better than you originally imagined.

Processing rocks!

 
The problem is not that i can't wrap my head around your idea, in fact i totally understand it, the problem is that it is just not a good idea whatsoever. It's like so obvious that i don't know how to explain it... Can someone else please comment on this so that i know that i'm not going insane (or that the rest of the world is going insane depending on how you look at it)...
First, the idea isn't totally new, search about steganography. Well, the latter is more about hiding information in an image, so disturbances must be minimal.
Second, I don't buy the " increases their mobilty and archiving value. Not to talk about compactibility ." arguments.
Text files are small, universal (pure Ascii or UTF-8), and you can still read them with any standard tool.
If space is an issue, just use an archiving software, text files can usually be compressed with a high ratio, again to be read by most archive softwares.
Beside, a text file can have an arbitrary size, while images are rectangular, so its size must look like w x h, some space can be wasted... And don't even try to save your image in Jpeg format!

So, I don't want to discourage you to explore this way if it is fun for you, but we are not convinced it has the advantages you claim...
I understand your difficulty grasping the idea. Also this idea is not unique. Person(s) have used three images to store 3d data in the past.

However the point about images being rectangular is not a factor since, I base the data on a pixel by pixel basis. The pixel can always be manipulated to indicate where the character goes but that is not what I am after.

The best way I can describe it is another the technique I now use where I can stack eight (8) text files into one image

color c1 = color (a,b,c,d);
color c2 = color (e,f,g,h);


you have eight diffferent pixels each from the eight (8) text files

int mod1 = (int)c1/255;
int rem1 = c1% 255;
int mod2 = (int)c2/255;
int rem2 = c2% 255;

color mixcolor = color(mod1,rem1,mod2,mix2);

The above is a classic example of what I am talking aboute
Hint

Try typing c1%_255 without the space you get c1%5 instead of c1% 255 (minus the space of course) try it..
This is probably due to the fact that some special coding prevents % and 255 to be concatenated.
Also above I have highlighted the text in red and bold it to highlight it. I am not sure of the exact html but in html you simply start a beginning tag with bold and colour red turned on and then you end with the tag to turn off bold and go to normal font.

If you wanted to do a basic text editor , each pixel could be used to
red = byte value of character
green = font size [0..255]
bue = style[0 = normal 1 = bold , 2 = italic , 3 = underline , and so on and so on up to 255 = subscript]
alpha = whatever you can imagine to store

now at the point of editting you can work with one document. All text files in notepad don't have formatting so the above is just a spur of the moment idea; but what I am getting at is this makes you think of what ways I  can use this to create what I want.



Once you do this you have one pixel storing eight (letters)

You just have to un mix by doing the reversal.

The algorithm to do the reversal is the opposite of the mixing process.

Pixel array devices are my target and I am not a fan of text based renders.
A basic idea is what the kindle can do. That was a basic e-reader but with this method you have a black and white device reading a file which is colour producing 8 pages from one .png file.

It would make no sense to use jpeg format. Integrity and transparency is key to achieve mixing eight characters in any given pixel.

Another way to look at this is the pain and effort one goes through flipping a page of a book. Each picture on screen carries eight (8) pages. If you had an digital scanner which produced .png files using this technique. Your interest is nor human-eye readability; you are interested in the accurate and compact data representation of the source material.

This method gives you this and even more. All text files have spaces in them. otherwise

youwouldjustreadawholebunchoftextonscreenandyouwouldhaveagreatdifficultydecipheringtheflowofthemessage.thesespacesare
inthefileasbytecharactersnowithanimageyouarenotintertestedinthereadabilityoftheimage.


My point is this. We all use webpages in some form, they are just text files when you use Tools--view source.

All I am suggesting is that I use this format to store the data.. that's all. Using the  advantages I listed above. At first it comes off a bit like...why ... that is not really ideal but when you actually start archiving your ton of processing sketches you found as you go over the internet. You start to think of cool ways to store all of them that Processing in turn can decipher them without searching through a whole bunch of text files. You are doing that but just in a different way.

Processing has this cool way of making you think outside the box, because there is nothing quite like it.

It's better than cake!