User Tag List

Page 2 of 2 FirstFirst 1 2
Results 11 to 19 of 19

Thread: Picture Resize Methods Linear, Cubic, Sinc Larcosz

  1. #11
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    Tiles's Avatar
    Join Date
    Jun 2006
    Posts
    1,359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Picture Resize Methods Linear, Cubic, Sinc Lar

    Many thanks for your help

    So the calculation is done while resizing, and not at the resized picture? Because that's what i do here. I resize it without any method, then resample it. (With that method i get mad with the border by the way. I cannot prevent to get a black border, no matter how i setup the fastloop )

    What i don't understand with your explanation is that you only use four pixels. Wouldn't this lead to a in one direction stretched picture? Which Pixels are used for the calculation then? Let's say C is the centerpixel, and S are the pixels around to test. How does it look like then? Which of the following pixels gets tested?

    CS
    SS

    SC
    SS

    SS
    CS

    SS
    SC

    Edit, got it working without borders. Phew, what a battle ...



    I will have a look to optimize it and will put it into the file archive then. Then we have a better base to talk about

  2. #12
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Picture Resize Methods Linear, Cubic, Sinc Lar

    In linear upscaling, if the pixel in the destination image falls exactly on a pixel in the source, no interpolation happens, you get exactly that pixel. It's only if the pixel in the destination is technically in the middle of a block of 4 in the source that it interpolates between them to find out what colour it should be.

    This means that you don't have a center pixel, only the four pixels "around" the location you're trying to sample.

  3. #13
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    Tiles's Avatar
    Join Date
    Jun 2006
    Posts
    1,359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Picture Resize Methods Linear, Cubic, Sinc Lar

    Ah, so it's a thing that looks like this:

    .S.
    S.S
    .S.

    Or more this?

    SS
    SS

    Hmm, i am in trouble to understand it. How would you calculate Pixel 1 here? And Pixel 2?



    Oh how neat would be a working example *hint* :grin:

  4. #14
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Picture Resize Methods Linear, Cubic, Sinc Lar

    The 2nd one:
    SS
    SS

    Here's a practical example using your image above:
    Point 1 is at coordinates 1,1 (and Point 2 is at 2,2) counting from the top-left.
    Divide by Size-1 of the destination image (4-1=3) and multiply by Size-1 of the source image (2-1=1) giving 0.333,0.333
    (I'll ignore Point 2 from now on)
    Then floor your coordinates to get the base pixel, and take just the fractional part to get the blend amounts. So BaseX=0,BaseY=0, BlendX=0.333, BlendY=0.333
    Then use the following formula to get the colour:
    Code:
    Colour("Source",BaseX,  BaseY)  *(1-BlendX)*(1-BlendY) +
    Colour("Source",BaseX+1,BaseY)  *(BlendX)  *(1-BlendY) +
    Colour("Source",BaseX,  BaseY+1)*(1-BlendX)*(BlendY)   +
    Colour("Source",BaseX+1,BaseY+1)*(BlendX)  *(BlendY)
    Note that the corner pixels of the destination image always match the corner pixels of the source image, and the edges of the image are all 1-d blends (BlendX or BlendY 0)

    EDIT: If you don't get it from this, then I'll make a working example after work.

  5. #15
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleSWF Export ModuleFirefly 3D ModuleInstall Creator Pro
    Brovic's Avatar
    Join Date
    Jul 2006
    Location
    France
    Posts
    321
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Picture Resize Methods Linear, Cubic, Sinc Lar

    Acitves cannot load pictures at runtime afaik, nor can it save a picture then. So there is no way to use its resampling.
    You can load frames inside actives. Then You can paste them into the overlay to save them. But if I remember when you paste a resized active on the overlay it pastes the original not the resized one so it may not work.

    But if you don't bother showing the picture at screen and the size fits on it you can just use an active picture and save it via the screen capture object.

  6. #16
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    Tiles's Avatar
    Join Date
    Jun 2006
    Posts
    1,359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Picture Resize Methods Linear, Cubic, Sinc Lar

    Sure you can load frames inside actives. But you cannot load external files. And that's what i need. Besides the hurdles you have told: i have to resize. That's all this about. And that i may need to work with 4096 pixel big pictures under some circumstances. I don't think that you can capture such a size :P

    Nevertheless thanks for your input

    Dynasoft, i am a very visual person. Explain me something and it can take eons until i understand it. Show me something and i understand it very quick. So an example is very very welcome

    I have uploaded my own try now to the file archive. Have a look for the cubic resampling thread

  7. #17
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Picture Resize Methods Linear, Cubic, Sinc Lar

    http://www.dynamicarcade.co.uk/examples/MMF2/Scaling.zip

  8. #18
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    Tiles's Avatar
    Join Date
    Jun 2006
    Posts
    1,359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Picture Resize Methods Linear, Cubic, Sinc Lar

    This is genious. And pretty quick. Thank you very much for this example

    I think i understand now what's going on. Now let's rewrite it for cubic

    EDIT, nope, again beaten by the "Expression too complex limit". I hate it :cry:

  9. #19
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module
    Tiles's Avatar
    Join Date
    Jun 2006
    Posts
    1,359
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Picture Resize Methods Linear, Cubic, Sinc Lar

    Okay, i give up. Bicubic interpolation is behind my horizon. Not so much the idea, but getting anything out of the available formulas. For most of the used letters i even don`t know how to type them at my keyboard here :grin:

    And so there is no way to even set a single counter to any value. I know i need nine. But that's it, basically. Wiki talks about 16 coefficients and eight equations though. Something to get mad at ...

    Dynasoft, i know it is a big favour, but could you be so kind to give me also an example for the bicubic interpolation?

    Or can an extension developer be so kind to write a picture extension that can resize in linear and bicubic and load and save a picture?

Page 2 of 2 FirstFirst 1 2

Similar Threads

  1. Linear Filtering?
    By stuckboy in forum Hardware Accelerated Runtime
    Replies: 5
    Last Post: 19th July 2009, 01:10 PM
  2. 360 Degree and Cubic Panorama Extensions
    By Novabrain in forum Extension Developers Lobby
    Replies: 1
    Last Post: 15th March 2008, 09:51 PM
  3. Active Picture Resize Methods
    By Tiles in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 5th February 2008, 12:39 PM
  4. Cubic resampling
    By Tiles in forum File Archive
    Replies: 7
    Last Post: 26th January 2008, 11:48 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •