Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8872989
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:21:17+00:00 2026-06-14T18:21:17+00:00

I need help with image processing in Octave. I’m trying to calculate a local

  • 0

I need help with image processing in Octave. I’m trying to calculate a local “sliding window” ssd on some images. The slowness is excessive (the nested for loops add up to 88*120*41*41 iterations), so it’s impossible to work with it. The version i’m using is 3.6.2 on Windows7 64bit. (corei5)

I’m launching the following octave script

http://pastebin.com/AjDJSX6e

onto the following image

http://picpaste.com/pattern1-90xYCNZB.bmp

Any suggestion?
Thank you in advance for your attention

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T18:21:19+00:00Added an answer on June 14, 2026 at 6:21 pm

    Take a loop at the functions filter2, ordfilt2 and blockproc (this last one is most likely what you will use. It was called blkproc in package versions prior to 2.0.0). I didn’t take a good look at what your code is trying to do but I’d be very surprised if those loops really are necessary. You seem to be doing only simple arithmetic at different indexes. Learn how to vectorize your code and you’ll see a huge improvement. If you can explain what the code is supposed to be doing, we might be of more help.

    Also, you don’t need to use sum (sum (x)), you can and should replace these with sum (x(:)). And you also don’t need to use sum (x.^2), you can use sumsq (x). So your 4 function call sqrt (sum (sum (curDiff.^2))) of yours could be replaced by sumsq (curDiff(:)).

    Compare the following:

    octave> x = rand (5000, 5000);
    octave> t = cputime (); sqrt (sum (sum (x.^2))); cputime () - t
    ans =  0.25202
    octave> t = cputime (); sumsq (x(:));            cputime () - t
    ans =  0.060004
    

    Not only it’s much shorter and easier to read, it’s also 4x faster (which in a huge loop like yours will make a huge difference).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey all, i am in need of some help with keeping an image aspect
I need some help in renaming some images in a directory located at /images/graphicsLib/.
I need help with CUDA C. I am try programming image processing tools. And
I am working on some image processing project where I need to implement eraser
I need to upload image from iphone application to PHP server for some processing
I am trying to do some image processing on the GPU, e.g. median, blur,
I am trying to develop some codes of image processing. I want to design
I need help with making an image float onto the canvas in HTML5 and
Hello i am in desperate need of help on this i have an image
hy, i need a little help here: i use SWFupload to upload images! in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.