Live data from Hacker News

PixQL: SQL for image processing

github.com

31–35 of 35 posts

Re: PixQL: SQL for image processing

#32
post #22
post #6

If you are going to use SQL select, why use a separate operate statement when you could just use SQL's method for this, update? For that matter, if you are going to use SQL syntax, I would imagine you would want to keep one of the main features, which is joining of datasets. Being able to join an image with itself in some manner (or another image...), would be really useful. Instead of globals, use the images as tabl…

Author here- My reason for deviating slightly from traditional SQL syntax is that I don't find it to be super intuitive. Yes, "UPDATE color SET r = 255 WHERE col = 100" is a pretty straightforward looking thing for those of us familiar with SQL, but simple things like the fact that you set the value before deciding what you're setting the value of are a bit off putting. The separation of queries into multiple stateme…

Well, the two initial ideas I had for joining are to join to itself, and to join to another image. For example:

  # Join image to itself but offset by one pixel and report the average of the RGB values
  SELECT (img1_pixel.red+img2_pixel.red)/2
         (img1_pixel.green+img2_pixel.green/2
         (img1_pixel.blue+img2_pixel.blue)/2
  FROM   img1 img1_pixel INNER JOIN img1 img2_pixel
         ON img1_pixel.column = img2_pixel.column
         AND img1_pixel.row = img2_pixel.row+1;

  # Superimpose one image over another, offset by 100 pixels width/height
  UPDATE img1, img2
  SET    img1.rgb = img2.rgb
  WHERE  img1.row = img2.row+100
         AND img1.column = img2.column;

Re: PixQL: SQL for image processing

#33
post #4

This looks amazing, but it might be easier to express these sorts of ideas with a simple functional language. Does anyone know of a similar library in a lisp or ML?

There were some systems in the 90s in Common Lisp and Scheme, like http://www.nic.funet.fi/index/Science/audio/tmp/forweb.pdf

(I've forgotten the name or authors of the Scheme one.)

Re: PixQL: SQL for image processing

#34

Does this have any practical use? It seems like the image equivalent of treating an HTML file as a huge string of characters -- instead of as the representation of a DOM tree. Which makes very little sense. Plus, you seldom want to do trivial things like selecting red pixels and flipping their color to green. You want to select red eyes and flip those to their correct color.

I initially made this as a tool to help alongside game development - specifically spritesheet editing, and futzing with textures-as-data and the like. Was never intended to be a high level replacement for photoshop or anything hah.

(ugh, what is this "limit 2 posts per hour" madness... lol)

Re: PixQL: SQL for image processing

#35
post #24

I love this! Now all we need is some higher level DRAW operations (draw a line from here to there, draw a piece of rendered text here) and we can glue PixQL and ChartSQL together to implement SQL query result visualization to bitmaps completely in SQL (without going through SVG). PS: Under which license is the PixSQL code available?

Thanks for the feedback! Definitely considering where to prioritize features, and drawing or "select where in polygon(x1,y1,x2,y2,...)", etc... are definitely on the table (first I need to fiddle with some compatibility stuff and clean up the code a bit). As far as the license, I haven't yet decided... pretty new/naive when it comes to deciding something like that... I don't plan on selling it for money, and I obviou…

>not sure. (Any tips would be welcome :P)

Check out http://choosealicense.com/ .

Post reply on HN