How does Matlab's IP Toolbox compare with

Discussion in 'Digital Photography' started by 223rem, Nov 11, 2005.

  1. 223rem

    223rem Guest

    the "professional" image processing software such as Photoshop in terms
    of the sophistication of the algorithms?

    I do my image processing in Matlab (which I can use for free), using the
    Image Processing Toolbox. I've never used Photoshop, I never had the chance
    and it is too expensive anyway.

    The biggest advantage of Matlab is that you can implement
    your own algorithms; its biggest disadvantage is that it is *slow*.

    I'm wondering if the algorithms implemented in the Matlab IP toolbox
    (for example, the image resizing algorithm
    are inferior to Photoshop's algorithms.

    Does anyone else use Matlab?
    223rem, Nov 11, 2005
    1. Advertisements

  2. 223rem

    Doug Schwarz Guest

    You might be better off asking this question in the MATLAB newsgroup,
    comp.soft-sys.matlab, where you are likely to reach many more MATLAB
    users and even the developers of the IP Toolbox (they might be a bit
    biased though!).

    MATLAB is relatively slow because it uses double-precision floating
    point arithmetic for most things and since a double is 8 bytes you will
    have much greater memory use. Simply storing a 1200 by 1800 pixel image
    will take 1200x1800x3x8 = 51840000 = 49.44 MB. Also, depending on your
    computer, arithmetic with doubles might be slower than integer

    I'd be surprised if image resizing was noticeably better with either
    Doug Schwarz, Nov 11, 2005
    1. Advertisements

  3. 223rem

    223rem Guest

    Thanks; I wanted input from photography fans, mainly

    Well, you can cast to uint for storage; and use double only for
    computations. I'm prety sure Photoshop also uses double for computations.

    Lots of Matlab functions are not precompiled, and that slows things down
    a lot
    223rem, Nov 11, 2005
  4. 223rem

    george Guest

    Well, I guess if you consider "half the fun" to be in the coding!?!?! Then,
    you could
    always have even more "fun" and write your own image processing software in
    or C#... Seriously, you ought to check out one of the engineering
    newsgroups as I
    think the task of producing professional quality photos is daunting enough
    bringing the process to a total crawl by writing all your own could
    try 500 canned ones in PhotoShop in the time it'd take you to write one!
    And, if there
    is something you like/want to do repeatedly, PhotoShop essentially has a
    macro capability.
    Gee, I'm an engineer and I do photography to relax, not to have MORE
    engineering work!
    george, Nov 11, 2005
  5. Last time I looked, Matlab cost even more than Photoshop, and isn't
    particularly oriented to photography or even image processing
    Uint is still 4 bytes per sample value, while Photoshop uses 1 or
    sometimes 2. That's still a huge advantage in space used.

    Photoshop has an interface that allows you to do computations in
    floating point, but I'm pretty sure that most built-in operations will
    use some of the SIMD instructions to calculate 4 results at the same
    time instead of one. Also, there's often a speed difference between
    single and double precision floating point, so even when Photoshop
    is using FP it would be using faster operations.
    That's interpreter overhead. But even with "compiled" functions, you're
    using generic double precision math matrix routines, not handwritten
    code specific to a particular filter.

    Dave Martindale, Nov 11, 2005
  6. 223rem

    Doug Schwarz Guest

    Yes, of course, but because computations in MATLAB are vectorized you
    still have to have space for intermediate storage. Suppose you have an
    image (1200 by 1800 color pixels) stored as uint8, call it A. Just
    adding one to each pixel and then storing the result back in A:

    A = uint8(double(A) + 1);

    will do something like

    1. Allocate 49.44 MB for double(A), call it temp1
    2. Convert A to double
    3. Allocate 49.44 MB for the result of double(A) + 1, call it temp2
    4. Compute double(A) + 1
    5. Deallocate temporary storage temp1
    6. Allocate storage for result
    7. Convert double(A) + 1 to uint8
    8. Associate the name A with this memory.
    9. Deallocate temp2
    10. Deallocate the storage originally associated with A.

    So, a simple operation like this requires temporary storage of 2*49.44
    MB or nearly 100 MB and if allocating this causes disk swapping the
    operation will be very slow.

    I have no idea if Photoshop uses doubles internally, but if it does I'll
    bet it does some kind of block processing to use less memory. You can
    do things like that in MATLAB, also, but you'll have to program it.
    Check out blkproc.

    If by not precompiled you mean not built-in (i.e., an m-file) then you'd
    be wrong in general. It depends very much on the algorithm -- some
    algorithms are slowed down only a little by being implemented as an
    m-file and some a lot.

    If you have some operation that you'd like speeded up then by all means
    post a question to the MATLAB newsgroup and let the gurus take a shot at
    Doug Schwarz, Nov 11, 2005
  7. 223rem

    Steve Wolfe Guest

    I'm wondering if the algorithms implemented in the Matlab IP toolbox
    If they only offer nearest-neighbor, bilinear, and bicubic, chances are
    that it isn't going to be signficantly better, if at all. Don't forget that
    Photoshop has two bicubic algorithms (sharper and smoother) that are
    specifically tweaked for downsizing and upsizing, respectively.

    (Of course, there are other resizing algorithms that DO out-perform
    Photoshop, particularly if you match the algorithm to the image in

    Steve Wolfe, Nov 11, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.