ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Getting Images from a Camera
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

skippix

USA
68 Posts

Posted - Jan 21 2014 :  14:47:11  Show Profile  Reply
I've been through the demos and can see how they work, but I can't figure out how to do what I need to do.

I have a button the user can click to view photos on a camera attached to a pc.

I have my own form with an ImageEnMView that allows them to pick the files they want to import. It works great for anything with a normal file path (c:\users\bob\pictures, G:\DCIM\100EOS7D, etc) and I want to be able to use to browse camera.

I also can't figure out how to get a list of which files a user has selected or how to control where the files get copied to off of the camera.

There's a chance I could figure this out, but I can't find the source code.

Thanks for your help!

w2m

USA
1990 Posts

Posted - Jan 21 2014 :  18:05:04  Show Profile  Reply
Do you have a problem with this part?
I do not understand what you are trying to say...
quote:
I have my own form with an ImageEnMView that allows them to pick the files they want to import. It works great for anything with a normal file path (c:\users\bob\pictures, G:\DCIM\100EOS7D, etc) and I want to be able to use to browse camera.

If you use a ImageEnFolderMView1 almost everything is done for you.
To copy the files:
procedure TForm1.CopySelectedFiles1Click(Sender: TObject);
{Copy Selected Files To Destination Folder. }
begin
  if SysUtils.DirectoryExists(DestinationFolder1.Text) then
  begin    
    ImageEnFolderMView1.FileOperationOptions := [ieioShowProgress, ieioVerboseErrors, ieioRenameOnCollision];
    ImageEnFolderMView1.CopySelectedFilesToFolder(DestinationFolder1.Text);
  end;
end;

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page

skippix

USA
68 Posts

Posted - Jan 21 2014 :  18:17:33  Show Profile  Reply
Your response solves my second question, but still leaves me with my first issue. I'm saying I can't figure out how to populate ImageEnFolderMView1 with images found on an attached camera.

I hate to be dense, but I can't find the Delphi source code.
Go to Top of Page

w2m

USA
1990 Posts

Posted - Jan 21 2014 :  18:34:06  Show Profile  Reply
Just replace your TImageEnMView with a TImageEnFolderMView and set the TImageEnFolderMView folder and the files will be automatically loaded.
procedure TForm1.CameraFolder1Change(Sender: TObject);
{ Open the camera files and display them in ImageEnFolderMView. }
begin
  if SysUtils.DirectoryExists(CameraFolder1.Text) then
  begin
    ImageEnFolderMView1.SetFolderEx(CameraFolder1.Text, iefAllImages, '');
    StatusBar1.Panels[0].Text := 'Camera Folder: ' + CameraFolder1.Text;
  end
  else
  begin
    MessageBox(0, PChar('The folder ' + CameraFolder1.Text +
      ' does not exist.'), 'Warning', MB_ICONWARNING or MB_OK);
  end;
end;

I made a small demo that shows all of this, but you should beable to do it too. I'll post the demo tomorrow.

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page

skippix

USA
68 Posts

Posted - Jan 21 2014 :  19:05:43  Show Profile  Reply
Thanks, a demo would be great! I'm stuck on what valid values could populate CameraFolder1.Text.
Go to Top of Page

w2m

USA
1990 Posts

Posted - Jan 21 2014 :  19:18:30  Show Profile  Reply
function DesktopFolder: string;
{ Find Desktop folder location. }
var
  ir: Boolean;
  iPath: array [0 .. MAX_PATH] of char;
begin
  ir := ShlObj.ShGetSpecialFolderPath(0, iPath, CSIDL_DESKTOP, False);
  if not ir then
    raise Exception.Create('Could not find Desktop folder location.');
  Result := IncludeTrailingPathDelimiter(iPath);
end;

function BrowseForFolder(AFolder: string): string;
{ Browse For Folder. }
begin
  if SysUtils.DirectoryExists(AFolder) then
    if FileCtrl.SelectDirectory('Select Folder', 'Desktop', AFolder) then
      Result := AFolder;
end;

procedure TForm1.BrowseForCameraFolder1Click(Sender: TObject);
{ Set the camera folder. }
var
  iFolder: string;
  iCameraFolder: string;
begin
  if SysUtils.DirectoryExists(iCameraFolder) then
    iFolder := CameraFolder1.Text
  else
    iFolder := DesktopFolder;
  iCameraFolder := BrowseForFolder(iFolder);
  if SysUtils.DirectoryExists(iCameraFolder) then
  begin
    CameraFolder1.Text := iCameraFolder;
  end;
end;

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html

Go to Top of Page

skippix

USA
68 Posts

Posted - Jan 21 2014 :  20:29:27  Show Profile  Reply
That seems like it would work, but when I run it, it fails to show my connected camera anywhere on the list when SelectDirectory is called.

Go to Top of Page

w2m

USA
1990 Posts

Posted - Jan 22 2014 :  10:20:46  Show Profile  Reply
When I plug in my Nikon P520 camera to the usb port, the camera appears in the shell as ThisPc\P520\Removable storage\DCIM\101NIKON. There is no drive letter because this is a windows virtual folder.

So far I have not been able to find any code that converts a virtual folder path to a string path. Some cameras have a menu option to change how the camera connects as a storage device:

Go into the menu of your camera, find the setting that tells it what to do when connected via USB to the PC and change that to "Storage Device" (anything that doesn't look proprietary, you probably have 2 or 3 options). By default your camera is set to a mode that allows it to talk to camera-automation software running on the PC! Once you change that setting to "storage device" Windows will treat it like any other USB storage device, will assign it a drive letter and you'll be able to access it from your Delphi application. Or do what most camera owners do, take out the card out of your DSLR and put it into your card reader.

When you use a card reader, the card will have a valid sting path with an assigned drive letter and a valid folder path.

Unfortunately, my Nikon P520 camera appears in the windows shell as a virtual folder with no drive letter and there is no menu setting to change how the storage device is handled... so I am stuck with using a card reader as well.

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page

w2m

USA
1990 Posts

Posted - Jan 23 2014 :  08:22:37  Show Profile  Reply
Nigel,

When you plug most cameras into a USB port, they appear in Windows Explorer or in the shell as a virtual folder, so the pictures do not have a valid file system path. When you plug in a camera it appears in the shell as the camera make and model like: P520 or as Cannon Powershot A3100 IS as a virtual folder.

Unfortunately, TImageEnFolderMView or TImageEnFolderMView.PromptForFolder does not recognize the virtual folder as you would expect.

Most card readers connect to the windows shell through the filesystem so at the moment, this is the only way that TImageEnFolderMView can view pictures on a camera card.

Is it possible to add support for virtual folders to TImageEnFolderMView and include copying and moving pictures from the virtual folder to a destination drive?

William Miller
Adirondack Software & Graphics
Email: w2m@frontiernet.net
EBook: http://www.imageen.com/ebook/
Apprehend: http://www.frontiernet.net/~w2m/index.html
Go to Top of Page

xequte

39061 Posts

Posted - Jan 23 2014 :  11:52:57  Show Profile  Reply
Hi Bill

I have this on our to-do list, unfortunately when I last investigated it looked like a major task, so it probably won't be ready in the short term.



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

xequte

39061 Posts

Posted - Jan 28 2014 :  22:06:39  Show Profile  Reply
Hi Bill

Also see:

http://www.imageen.com/ieforum/topic.asp?TOPIC_ID=1236

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: