Stories
Slash Boxes
Comments

SoylentNews is people

SoylentNews is powered by your submissions, so send in your scoop. Only 19 submissions in the queue.
posted by Fnord666 on Tuesday October 01 2019, @03:28AM   Printer-friendly
from the making-it-up dept.

Arthur T Knackerbracket has found the following story:

Under the right circumstances, Gaussian blurring can make an image seem more clearly defined. [DZL] demonstrates exactly this with a lightweight and compact Gaussian interpolation routine to make the low-resolution thermal sensor data display much better on a small OLED.

[...] used an MLX90640 sensor to create a DIY thermal imager with a small OLED display, but since the sensor is relatively low-resolution at 32×24, displaying the data directly looks awfully blocky. Gaussian interpolation to improve the display looks really good, but it turns out that the full Gaussian interpolation isn’t a trivial calculation write on your own. Since [DZL] wanted to implement it on a microcontroller, the lightweight implementation was born. The project page walks through the details of Gaussian interpolation and how some effective shortcuts were made, so be sure to give it a look.


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
(1)
  • (Score: 1, Interesting) by Anonymous Coward on Tuesday October 01 2019, @03:55AM (10 children)

    by Anonymous Coward on Tuesday October 01 2019, @03:55AM (#901116)

    TFL ends with a thermal image of a hand, lots of curvy edges, and the blurred & upsampled image does look better.

    However, if you are looking for studs in a wall (straight lines), my guess is that you do better with the raw data, combined with moving the sensor to locate the edge at native sensor resolution. Didn't notice any mention of a way to turn the blur off it isn't wanted.

    Comments?

    • (Score: 0) by Anonymous Coward on Tuesday October 01 2019, @04:05AM (8 children)

      by Anonymous Coward on Tuesday October 01 2019, @04:05AM (#901122)

      So they use a low-resolution 32×24 sensor. What are the costs for these things? Why not use a smartphone-attached one?

      The FLIR ONE Gen 3 [flir.com] is $200 for 80x60 resolution. Seek Thermal offers options for $250, $300, and $500 [thermal.com]. The cheaper ones are 206x156, and the $500 one does 320x240, literally a hundred times better than the DIY crap. Go on the used market, get an older model, pair it with a cheap smartphone, and you might have something useful.

      • (Score: 4, Insightful) by c0lo on Tuesday October 01 2019, @05:08AM (6 children)

        by c0lo (156) Subscriber Badge on Tuesday October 01 2019, @05:08AM (#901136) Journal

        literally a hundred times better than the DIY crap

        Speak for yourself (and feel free to waste your money on whatevs gizmos excite you) but abstain from judging others by your standard.

        When you develop cheap (but useful) things using micro-controllers to run unassisted for days on end (sensors and what not), then less is so much better (i.e. you will be extremely happy to be able to do the same with less). At least two things that you want to consider:
        * you want as low energy consumption as possible. Even better if your electronics can control the time when your sensor is on (instead of being on all the time) - may make a difference from 3 days between a changing the batteries to half a year.
        * higher resolution doesn't help when you don't have too much RAM/processing power anyway (we are speaking about a range of 2-32kB of it, with a 16MHz clock)

        --
        https://www.youtube.com/watch?v=aoFiw2jMy-0 https://soylentnews.org/~MichaelDavidCrawford
        • (Score: 2) by hemocyanin on Tuesday October 01 2019, @05:21AM (5 children)

          by hemocyanin (186) on Tuesday October 01 2019, @05:21AM (#901139) Journal

          No kidding -- why would someone come here and denigrate a DIY electronics project? Who cares if you can buy X -- that's not the point of DIY.

          • (Score: 0) by Anonymous Coward on Tuesday October 01 2019, @05:55AM (4 children)

            by Anonymous Coward on Tuesday October 01 2019, @05:55AM (#901147)

            Did they make the MLX90640 sensor by hand?

            • (Score: 2) by c0lo on Tuesday October 01 2019, @07:43AM

              by c0lo (156) Subscriber Badge on Tuesday October 01 2019, @07:43AM (#901176) Journal

              Just in case you feel the need of a point, I'm happy to let you have one -> . <- here, take this one; it's guaranteed to be more to the point than your comment.

              --
              https://www.youtube.com/watch?v=aoFiw2jMy-0 https://soylentnews.org/~MichaelDavidCrawford
            • (Score: 2) by hemocyanin on Tuesday October 01 2019, @04:28PM (2 children)

              by hemocyanin (186) on Tuesday October 01 2019, @04:28PM (#901365) Journal

              Did you smelt the metal to build a shovel to dig the clay your morning coffee cup is made out of? People start in the middle ALL the time. Literally nobody starts from nothing.

              • (Score: 2) by Immerman on Wednesday October 02 2019, @12:05AM (1 child)

                by Immerman (3985) on Wednesday October 02 2019, @12:05AM (#901585)

                Well, not *literally* nobody. Some people enjoy starting from (nearly) nothing sometimes. I've got a friend that decided to make himself a goatskin drum. Step 1: knap a stone scraping tool in order to scrape the raw uncured hide...

                • (Score: 2) by hemocyanin on Wednesday October 02 2019, @03:47AM

                  by hemocyanin (186) on Wednesday October 02 2019, @03:47AM (#901700) Journal

                  I have a lot of respect for that, but he didn't start back far enough. I presume he went out and found the flint, which is great, but I suspect he drove somewhere while wearing clothes and boots and used tools to get the stone. He needs to start naked in his back yard and work up from there. Otherwise, he started in somewhere in the middle.

      • (Score: 4, Interesting) by janrinok on Tuesday October 01 2019, @07:55AM

        by janrinok (52) Subscriber Badge on Tuesday October 01 2019, @07:55AM (#901180) Journal

        $93 versus $200, plus it works with a RPi or Arduino and not a smartphone costing many hundreds of dollars. How would you employ your smartphone in a permanent set-up that was observing the temperature change in a specific view?

        Furthermore, the article provides the code and the mathematics so that they can be adapted to other purposes. Lots of us like stories such as this - otherwise we would just browse Amazon and buy something of the shelf.

    • (Score: 1, Informative) by Anonymous Coward on Tuesday October 01 2019, @04:07AM

      by Anonymous Coward on Tuesday October 01 2019, @04:07AM (#901124)

      It's more comfortable to mount studs on a bed.

  • (Score: 3, Insightful) by FatPhil on Tuesday October 01 2019, @06:34AM (22 children)

    by FatPhil (863) <pc-soylentNO@SPAMasdf.fi> on Tuesday October 01 2019, @06:34AM (#901153) Homepage
    He has magic numbers that depend on other magic numbers that are not defined in terms of the numbers they depend on (e.g. the 0x00000040 and the 5). Worse, they don't just depend on the 32, they depend on unstated, unasserted, properties of that 32, namely that it's power of 2.

    Also - I saw no templates, no generics, no polymorphism, nothing requiring C++ and the use of a class. Why the heck would you not use good old-fashioned C for this?

    Also - the formula used to generate the kernel weights would be nice - how can I know they are correct?

    Also - I know they can't be correct, as if you're truncating your kernels so small, you're not doing a gaussian blus, you should perhaps look into a simpler FIR filter that doesn't even require FP arithmetic and perhaps can even be calculated streamably (rather than this random access, always calculate every input pixel's value times its current weight).

    Most of these are small complaints, easily fixable, and were I still in a teaching role I'd still give it a B+ or even A- depending on the magnitude of the task.
    --
    Great minds discuss ideas; average minds discuss events; small minds discuss people; the smallest discuss themselves
    • (Score: 2) by aiwarrior on Tuesday October 01 2019, @07:18AM (1 child)

      by aiwarrior (1812) on Tuesday October 01 2019, @07:18AM (#901167) Journal

      The score you gave was for the Gaussian blur or for the project as a whole?

      • (Score: 2) by FatPhil on Tuesday October 01 2019, @07:27AM

        by FatPhil (863) <pc-soylentNO@SPAMasdf.fi> on Tuesday October 01 2019, @07:27AM (#901169) Homepage
        Just the code.
        --
        Great minds discuss ideas; average minds discuss events; small minds discuss people; the smallest discuss themselves
    • (Score: 3, Touché) by FatPhil on Tuesday October 01 2019, @07:27AM (2 children)

      by FatPhil (863) <pc-soylentNO@SPAMasdf.fi> on Tuesday October 01 2019, @07:27AM (#901168) Homepage
      Also - don't start your loop at 1 and end with a < test. You're either 0-based (please!) or 1-based (please not!), but never a mix of the two.

      Also - don't read outside the source array (see the top line of the output image - it's mostly composed of noise from reading arbitrary non-image data. Less obvious that it's also doing it at the bottom of the image, but from the code it's clear that it is. A simple 2D loop with separate previous_line and latest_line offsets would be just as simple (he says he's optimised for "simplicity", but treating a 2D array of data as 1D is *not* a simplification, it's an obfuscation).

      Looking more like a B on second thoughts.
      --
      Great minds discuss ideas; average minds discuss events; small minds discuss people; the smallest discuss themselves
      • (Score: 1, Funny) by Anonymous Coward on Tuesday October 01 2019, @12:03PM

        by Anonymous Coward on Tuesday October 01 2019, @12:03PM (#901238)

        don't start your loop at 1 and end with a < test. You're either 0-based (please!) or 1-based (please not!), but never a mix of the two.

        for (i=-1; ++i < LOOP_MAX;) { ... }

      • (Score: 1, Funny) by Anonymous Coward on Tuesday October 01 2019, @05:13PM

        by Anonymous Coward on Tuesday October 01 2019, @05:13PM (#901376)

        I'd give you a low grade for your unbalanced parentheses - it's like you didn't even try to compile your comment!

    • (Score: 3, Informative) by janrinok on Tuesday October 01 2019, @08:10AM

      by janrinok (52) Subscriber Badge on Tuesday October 01 2019, @08:10AM (#901183) Journal

      Also - the formula used to generate the kernel weights would be nice - how can I know they are correct?

      Well the article does show how they were calculated [theomader.com] but it is true that the formula is not published directly. He does, however, also reference each of the sources for the formulae on this link too.

      nothing requiring C++ and the use of a class. Why the heck would you not use good old-fashioned C for this?

      The Arduino IDE is C++ based - he used what he had for coding on an Arduino board. Doesn't seem too unreasonable to me. After all, one usually starts with Arduino programming by blinking LEDs and similar simple circuits - none of which needs C++, but that is what everybody uses. The majority of Arduino libraries (including the one for the IC under discussion) are C++ based too.

    • (Score: 2) by Coward, Anonymous on Tuesday October 01 2019, @09:18AM (7 children)

      by Coward, Anonymous (7017) on Tuesday October 01 2019, @09:18AM (#901198) Journal

      Also - I saw no templates, no generics, no polymorphism, nothing requiring C++ and the use of a class. Why the heck would you not use good old-fashioned C for this?

      That is a real nitpick. Maybe they are most comfortable with C++, and want the option of using more advanced language features in the future. Not everyone likes the C-straightjacket.

      • (Score: 2) by FatPhil on Tuesday October 01 2019, @01:09PM (6 children)

        by FatPhil (863) <pc-soylentNO@SPAMasdf.fi> on Tuesday October 01 2019, @01:09PM (#901254) Homepage
        How is
            void foo(float *a, float *b);
        a straightjacket compared to
            class foo_doer { void foo(float *a, float *b); };
        ?

        Hmm, should that foo not be static, as it acts independently of any instance's member variables?
        And const for that matter - as it doesn't change the instance it pretends to (but doesn't) act on?

        He's using *none* of the features that C++ provides that are in any way an improvement over C, he's using a 105-blade swiss army knife to clean poop out from under his fingernails. That's the cumbersome choice, not C.
        --
        Great minds discuss ideas; average minds discuss events; small minds discuss people; the smallest discuss themselves
        • (Score: 1, Redundant) by Coward, Anonymous on Tuesday October 01 2019, @04:29PM (5 children)

          by Coward, Anonymous (7017) on Tuesday October 01 2019, @04:29PM (#901366) Journal

          for(int i ...

          compiles fine in C++, but not C.

          • (Score: 0) by Anonymous Coward on Tuesday October 01 2019, @05:58PM (2 children)

            by Anonymous Coward on Tuesday October 01 2019, @05:58PM (#901395)

            for(int i ...

            compiles fine in C++, but not C.

            for loop declarations like this have been part of standard C for over twenty years now. For comparison the first C++ standard was published in 1998, which included similarly new features such as the standard template library.

            I must conclude from your statement that STL code doesn't compile in C++ either, because C++ compilers from the 80s will reject such programs.

            • (Score: 2, Troll) by Coward, Anonymous on Thursday October 03 2019, @03:25AM (1 child)

              by Coward, Anonymous (7017) on Thursday October 03 2019, @03:25AM (#902145) Journal

              Texas Instruments MSP430 and MSP432 compilers (cl430 and armcl) at least make C89 the default for .c files. As far as I'm concerned, C is what compiles without errors on the tools I use, without me having to change options that might break something else. Presumably there is a reason that C99 is not used by default.

              • (Score: 2) by FatPhil on Thursday October 03 2019, @07:42AM

                by FatPhil (863) <pc-soylentNO@SPAMasdf.fi> on Thursday October 03 2019, @07:42AM (#902190) Homepage
                That fact that you use an obsolete version of the language without a feature does not support the unconditional claim that the language does not have that particular feature.
                --
                Great minds discuss ideas; average minds discuss events; small minds discuss people; the smallest discuss themselves
          • (Score: 2) by FatPhil on Tuesday October 01 2019, @11:42PM (1 child)

            by FatPhil (863) <pc-soylentNO@SPAMasdf.fi> on Tuesday October 01 2019, @11:42PM (#901567) Homepage
            Fuck off, idiot.
            --
            Great minds discuss ideas; average minds discuss events; small minds discuss people; the smallest discuss themselves
    • (Score: 2) by c0lo on Tuesday October 01 2019, @09:27AM (6 children)

      by c0lo (156) Subscriber Badge on Tuesday October 01 2019, @09:27AM (#901203) Journal

      Try doing all that on the C++ dialect that Arduino compiler can understand and maybe you will see why.
      (In brief, there's no new operator, classes can only have static methods - therefore no inheritance, no virtual members - no templates either, there's only float no double, and if you want performance, you will be happy to translate everything into integral arithmetics anyway, 'cause of course you can't has coprocessor on a microcontroller).

      --
      https://www.youtube.com/watch?v=aoFiw2jMy-0 https://soylentnews.org/~MichaelDavidCrawford
      • (Score: 2, Informative) by WeekendMonkey on Tuesday October 01 2019, @10:52AM (1 child)

        by WeekendMonkey (5209) Subscriber Badge on Tuesday October 01 2019, @10:52AM (#901222)

        You might want to re-visit the Arduino dev tools. I have a current project that is happily using new/delete, inheritance and virtual members. Not sure about Templates though.

        • (Score: 2) by c0lo on Tuesday October 01 2019, @11:20AM

          by c0lo (156) Subscriber Badge on Tuesday October 01 2019, @11:20AM (#901228) Journal

          Thanks, I will one of these days.
          My knowledge may indeed be outdated by 3-4 years (since I had enough time to seriously follow a - hobby - project to the end).

          --
          https://www.youtube.com/watch?v=aoFiw2jMy-0 https://soylentnews.org/~MichaelDavidCrawford
      • (Score: 2) by FatPhil on Tuesday October 01 2019, @01:11PM (3 children)

        by FatPhil (863) <pc-soylentNO@SPAMasdf.fi> on Tuesday October 01 2019, @01:11PM (#901256) Homepage
        Now reread my post for comprehension this time.
        --
        Great minds discuss ideas; average minds discuss events; small minds discuss people; the smallest discuss themselves
        • (Score: 2) by c0lo on Tuesday October 01 2019, @01:19PM (2 children)

          by c0lo (156) Subscriber Badge on Tuesday October 01 2019, @01:19PM (#901261) Journal

          Nah, why should I?
          Your post ain't gonna get better and I don't get any beer if I reread it.

          --
          https://www.youtube.com/watch?v=aoFiw2jMy-0 https://soylentnews.org/~MichaelDavidCrawford
          • (Score: 2) by FatPhil on Tuesday October 01 2019, @01:32PM (1 child)

            by FatPhil (863) <pc-soylentNO@SPAMasdf.fi> on Tuesday October 01 2019, @01:32PM (#901265) Homepage
            Depends if you want to come over as someone who reads something, misunderstands it, blurts out irrelevant nonsense, and then can't be bothered to correct himself when it's pointed out to him that he erred. Your choice.
            --
            Great minds discuss ideas; average minds discuss events; small minds discuss people; the smallest discuss themselves
            • (Score: 2) by c0lo on Tuesday October 01 2019, @01:39PM

              by c0lo (156) Subscriber Badge on Tuesday October 01 2019, @01:39PM (#901269) Journal

              Your choice.

              Indeed.
              I think I'm gonna go to sleep before it gets tomorrow around 'ere.

              --
              https://www.youtube.com/watch?v=aoFiw2jMy-0 https://soylentnews.org/~MichaelDavidCrawford
    • (Score: 2) by DannyB on Tuesday October 01 2019, @02:03PM

      by DannyB (5839) Subscriber Badge on Tuesday October 01 2019, @02:03PM (#901279) Journal

      the formula used to generate the kernel weights would be nice - how can I know they are correct?

      Take an IR image with the sensor. Open it in GIMP. Clean it up to look like what you want. Save that. Start with a random kernel. Use a genetic algorithm to evolve a kernel's magic numbers such that this kernel will clean up the original image into something close what you saved from GIMP. Use that as your kernel since it works very good in the rare case when the sensor captures this very specific image.

      In order to not spend a lot of time on the code that generats this kernel, use a higher order language for this one-off program. (Python, Lisp, Node.js, etc)

      SN feature request: <sarcasm> tags need a parameter to indicate the level of sarc, such as <sarcasm level="11">

      --
      When trying to solve a problem don't ask who suffers from the problem, ask who profits from the problem.
  • (Score: 1) by shrewdsheep on Tuesday October 01 2019, @08:30AM (2 children)

    by shrewdsheep (5215) on Tuesday October 01 2019, @08:30AM (#901189)

    This is of course known for a long time and the blurring algorithm is actually physically implemented in our body hardware. Just let the image get out of focus and there you are, if you have a blocky image to begin with, after blurring (defocusing), you might recognize a person when there were only pixels before. Evolution has us well-adapted for this recognition task, we seem to have been out of focus a lot recently (has it been being drunk, hit hard to often on the head, or just being to dumb to focus our vision (as in orange)?).

    • (Score: 2) by c0lo on Tuesday October 01 2019, @09:30AM

      by c0lo (156) Subscriber Badge on Tuesday October 01 2019, @09:30AM (#901206) Journal

      This is of course known for a long time

      One may say that hindsight vision is 20/20 non-blurry, right?

      --
      https://www.youtube.com/watch?v=aoFiw2jMy-0 https://soylentnews.org/~MichaelDavidCrawford
    • (Score: 2) by FatPhil on Tuesday October 01 2019, @01:29PM

      by FatPhil (863) <pc-soylentNO@SPAMasdf.fi> on Tuesday October 01 2019, @01:29PM (#901264) Homepage
      Defocussing is a different impulse response from (gaussian) blurring.

      Then again, he cares not, as he's doing upscaling by using nearest-neighbour and throwing away 13% of his kernel anyway. Had he chosen to keep upscaled pixels with the same centres as the original pixels rather than all be offset by (+/- 1/4, +/- 1/4) (i.e. done bilinear filtering), then he'd have come up with a different set of constants (and perhaps have changed his sigma, as less blurring would be necessary - or any, perhaps!). Which is the bigger lie: this pixel value represents the value for the centre of the region its capturing; or: this pixel value represents each of the four near-corners of the region its capturing?
      --
      Great minds discuss ideas; average minds discuss events; small minds discuss people; the smallest discuss themselves
  • (Score: 2) by Immerman on Tuesday October 01 2019, @01:43PM (2 children)

    by Immerman (3985) on Tuesday October 01 2019, @01:43PM (#901270)

    Not to throw cold water on a cool project, but why on earth would you blur the image, throwing away vast amounts of information as a result, if you want *improved* results? This is a common mistake that should be covered in Image Processing 101.

    You don't want blocky "zooming" followed by blurring, you want interpolative upscaling, based on the idea that the pixels represent point samples, rather than areas of color. Each original pixel is still present in its orginal color in the final image, so there's no information loss (e.g. as the center pixel of its upscaled block), while remaining pixels in the block are interpolated between those reference points. Simple linear upscaling looks about as good as the results they show, and that's the worst possible option. Sinusoidal upscaling looks far better, while requiring only 4 multiplications per new pixel (assuming weighting factors are precalculated for the desired scaling factor, and that your raw image is actually monochrome and you add the false color later). Bicubic looks much better even than that, and can reveal lots of detail you didn't even realize was captured in the original image, but it is considerably more computationally expensive.

    • (Score: 0) by Anonymous Coward on Tuesday October 01 2019, @09:24PM (1 child)

      by Anonymous Coward on Tuesday October 01 2019, @09:24PM (#901483)

      First AC poster here--
      Thanks for this comment, you did a better job of getting at the same point I was trying (feebly) to make.

      Generating "new points" by any algorithm may work OK in some cases, but not others. My case of stud finding (common use for IR cameras--studs are colder (in winter) than an insulated wall), I think it would be best to use the native resolution and move the camera around to figure out the edges of the colder 2x4 wall stud behind the wall board.

      • (Score: 2) by janrinok on Wednesday October 02 2019, @01:52PM

        by janrinok (52) Subscriber Badge on Wednesday October 02 2019, @01:52PM (#901830) Journal

        That might be true for your particular use case, but you'd be better off buying a stud finder. A fraction of the price ($50'ish) and doesn't require a smart phone either.

        But for those who want to get more apparent detail from an IR sensor, this is a pretty acceptable solution.

(1)