Login

Who's Online

Google








Home arrow Programmingarrow Help with downloaded scriptsarrow Google image downloader
Discussion Forum
January 09, 2009, 02:31:38 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: SMF - Just Installed!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Google image downloader  (Read 2762 times)
Mark Austin
Administrator
Full Member
*****
Posts: 101



View Profile Email
« on: February 02, 2007, 09:43:36 AM »

Please let me know if you have a go with the image downloader.  I hope you find it useful.
Logged
John Sader
Newbie
*
Posts: 4


View Profile Email
« Reply #1 on: July 28, 2007, 01:56:39 PM »

Hi,

I'm a total newbie to this but am extremely enthused to see this script running.

I've tried to follow the instructions to the letter, I created the desired cell array of names but  when I try to run this script in Matlab 7 I recieve:

>> downloadimagesfromgoogle(Names,1,1);
Huh Error: File: downloadimagesfromgoogle.m Line: 25 Column: 1
Function definitions are not permitted at the prompt or in scripts.

the line being referenced by the error is;

function downloadimagesfromgoogle(Names,start,finish)

In the event that I misunderstood the instructions, I've attached the modified script in the hope this would shed further light on the situation.

Your help would be greatly appreciated

Kind Regards
Logged
Mark Austin
Administrator
Full Member
*****
Posts: 101



View Profile Email
« Reply #2 on: July 30, 2007, 08:45:10 AM »

If an m file in matlab is to be a function, then the (uncommented) line in the file must start with the word "function" to define the function, thus by adding

Names{1,1}='hendrix';
Names{1,2}='joplin';
Names{1,3}='the_eagles';

you have generated an error.  You should either put those lines in at the command prompt, before calling  "downloadimagesfromgoogle(Names,1,1);" or you could move those lines inside the function and remove the Names parameter from the function, such that the first few lines of the m file look like this:

function downloadimagesfromgoogle(start,finish)

Names{1,1}='hendrix';
Names{1,2}='joplin';
Names{1,3}='the_eagles';

then you would simple call downloadimagesfromgoogle(1,1) from matlab.  I would suggest using the first method, as that was the way in which the script was intended to be used.
Logged
John Sader
Newbie
*
Posts: 4


View Profile Email
« Reply #3 on: July 30, 2007, 11:45:44 AM »

Yay, it works!  Grin

I'm watching the images coming down this very moment. So very excited about this script! I utilised the first method mentioned of entering the array at the command prompt then calling downloadimagesgoogle(Names,1,n). Absolutely brilliant!

However, I am now posed with the question of passing an argument to cease downloading after x amount of results. I fear that some of my search criteria may attempt to download the entire web. For example 'Jimi Hendrix' returns in excess of 600K results. Where do I start and what do I need to understand?

Kind regards and my sincere appreciation for the response.
Logged
Mark Austin
Administrator
Full Member
*****
Posts: 101



View Profile Email
« Reply #4 on: July 30, 2007, 04:55:15 PM »

Don't worry about there being too many images.  Google only caches the first 1,000 or so images, 910 in fact for jimi hendrix.  (http://images.google.co.uk/images?q=jimi+hendrix&ndsp=20&svnum=10&um=1&hl=en&rlz=1T4GZAZ_en-GBGB228GB228&start=900&sa=N) even though it says there are hundreds of thousands.  However, if that is too many it would be easy to modify the script to stop at whatever number you want.  Let me know if you cannot do it.
Logged
John Sader
Newbie
*
Posts: 4


View Profile Email
« Reply #5 on: August 01, 2007, 12:34:01 PM »

I wasn't aware that google only cached the first thousand or so results. Thanks for the info. Wink
I am, however, still at a loss. Your instruction on this one would be greatly appreciated. I only need the first 20 odd results for my searches.
Regards
Logged
Mark Austin
Administrator
Full Member
*****
Posts: 101



View Profile Email
« Reply #6 on: August 06, 2007, 12:13:17 PM »

Sorry for not replying sooner, I missed your post.

I had a quick look at doing what you wanted and posted the code here.  I have not tested it.  Let me know if it works.  You will need to log in to see the file.
« Last Edit: August 07, 2007, 10:20:02 AM by Mark Austin » Logged
John Sader
Newbie
*
Posts: 4


View Profile Email
« Reply #7 on: August 07, 2007, 12:59:01 PM »

Two thumbs up Grin I extend my sincerest gratitude for your assistance. This is exactly what I was hoping for. Many thanks and may the favour be returned to you.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.1 | SMF © 2006, Simple Machines LLC
Joomla Bridge by JoomlaHacks.com
© 2009 Everything That I Know About