Image input apparatus for storing image data into a removable recording medium

An image input apparatus includes a mounting unit adapted to mount a removable recording medium; and a lid for the mounting unit. If an opening of the lid is detected during access to the removable recording medium, the image input apparatus suspends the access to the removable recording medium after written data in the removable recording medium is consistent with file management information for the written data. If the lid is closed without removing the removable recording medium after the detection of the opening of the lid, the image input apparatus resumes the suspended access to the removable recording medium.

FIELD OF THE INVENTION

The present invention relates to an image input apparatus such as a digital still camera.

BACKGROUND OF THE INVENTION

When data is recorded on a recording medium such as a memory card, magnetic recording medium, optical recording medium, or the like, data management information including information which specifies the data to be recorded (e.g., a file name), recording start address, data size, and the like is recorded together with the data. Various methods are used to perform such data recording and management. For example, a data management method using a generally known FAT (File Allocation Table) file system will be described below.

A FAT file system comprises a boot sector area, FAT area, root directory area, data area, and the like. Data is managed in units called clusters. Parameters required to read/write data from/to a recording medium such as the number of FATs, the number of root directory entries, and the like are stored in the boot sector area. Chaining information of a plurality of clusters is stored in the FAT area when the plurality of clusters are used to record the data. The file name of the data to be recorded, the number of a cluster at which recording is started, data size, and other information are stored in the root directory area. The size of one cluster changes depending on the formatting method. A file larger than one cluster is recorded using a plurality of clusters.

For example, assume that three cluster (clusters 2, 3, and 4) are used to record a file. In this case, the next cluster number “3” is recorded in the FAT area of the cluster2, and “4” is recorded in the FAT area of the cluster3. A code (e.g., “FFFh” in the case of a 12-bit FAT) indicating the last cluster is recorded in the FAT area of the cluster4. The file name and cluster start number “2” are recorded in the area of a directory entry1of the root directory area.

In an apparatus which performs data recording using the above-mentioned file system, the data recording is suspended when a removable recording medium is removed while data is recorded on the recording medium, when the battery for the apparatus main body is removed, or when the battery abruptly lowers. If data recording is suspended in this manner, some problem occurs in data such as the FAT information (chaining information), directory entries, or the like. More specifically, the FAT information may be unchained, and correct data read may be disabled. Alternatively, the size of actually recorded data may become inconsistent with that of a file recorded in a directory entry. Alternatively, some chaining information may be recorded in the FAT of a cluster not in use, and the cluster may become unavailable.

For example, assume that in an apparatus using the FAT file system, data recording is suspended. In this case, neither the number of the next cluster nor the last code is recorded in the FAT area of a cluster in which data has been recorded. In addition, the size of a file in a directory entry is different from the size of actually recorded data. When some problem occurs in data such as directory entries, FAT information which is chaining information recorded on a recording medium, and the like, recorded data associated with the problem cannot be obtained correctly even by accessing and extracting the data later.

To cope with such problem, there is available a method of performing write to a data area (i.e., actual data write) after write to an area (file management area) in which data management information such as a FAT and the like is recorded is complete. When data write to a data area is suspended, a given cluster to be used next to a write-accessed cluster is assumed to be used by the management information although the given cluster is not in use. This makes it impossible to effectively use the capacity of a recording medium.

As another method, Japanese Patent Laid-Open No. 7-79403 (U.S. Pat. No. 5,585,845) proposes a method of recording data in a file having a temporary name at the start of recording, and changing the name to the original name upon completion of recording. This method eliminates an area in which invalid data is recorded. However, write to a management area such as a FAT area or the like is not prevented. Additionally, if the recording medium is used in another device, the other device cannot understand that the file has a temporary file name, and thus the area cannot be used. The method is not different from a conventional method.

SUMMARY OF THE INVENTION

An object of the present invention is to overcome the above-described drawbacks.

Another object of the present invention is to avoid a drawback that data written into a recording medium may not consistent with its data management information, e.g., FAT information, directory entries, etc.

According to the present invention, the foregoing object is attained by providing an image input apparatus for writing image data into a removable recording medium, comprising:

a mounting unit adapted to mount the removable recording medium; and

a lid for the mounting unit,

wherein if an opening of the lid is detected during a write access to the removable recording medium, the image input apparatus suspends the write access after written data is consistent with file management information for the written data.

According to another aspect of the present invention, the foregoing object is attained by providing an image input apparatus for writing image data into a first and/or second removable recording medium, comprising:

a first mounting unit adapted to mount the first removable recording medium;

a second mounting unit adapted to mount the second removable recording medium; and

a lid for the first and second mounting units, wherein if an opening of the lid is detected during accessing of the removable recording medium to write the image data into the first removable recording medium, the image input apparatus suspends the access to the first removable recording medium after data written into the first removable recording medium is consistent with file management information for the written data.

According to still another aspect of the present invention, the foregoing object is attained by providing an image input apparatus for writing image data into a first and/or second removable recording medium, comprising:

a first mounting unit adapted to mount the first removable recording medium;

a second mounting unit adapted to mount the second removable recording medium;

a first lid for the first mounting unit; and

a second lid for the second mounting unit, wherein if an opening of the first lid is detected during accessing of the removable recording medium to write the image data into the first removable recording medium, the image input apparatus suspends the access to the first removable recording medium after data written into the first removable recording medium is consistent with file management information for the written data.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

First Embodiment

FIG. 1is a block diagram showing an arrangement example of a digital camera as an example of an image input apparatus according to an embodiment of the present invention.

An image sensing unit11has an image sensing element such as a CCD sensor or CMOS sensor and optical components including a lens and AF mechanism. When a photographing instruction is input from an operation unit14comprising various buttons and the like such as a release switch, zoom button, buttons for various settings, and touch panel by, e.g., pressing the release switch, a controller15which controls the entire camera detects the instruction. The controller15generates a control signal in response to the photographing instruction and instructs the image sensing unit11to perform image sensing. The image sensing unit11performs image sensing in accordance with predetermined exposure parameters and outputs one image data obtained to an image processor12.

The image processor12performs predetermined various image processes (development). After that, the image processor12compression-codes the image data on the basis of predetermined encoding parameters (encoding format, compression ratio, and the like) and outputs the resultant data to a file system unit16. In this example, the image processor12performs JPEG-based compression coding. The file system unit16has a hardware interface for mounting a removable recording medium17and controls read/write of data on the mounted recording medium17.

Upon reception of image data from the image processor12, the file system unit16determines a new file name from the arrangement of folders and files in the mounted recording medium17, gives the determined file name to the image data, and stores the image data in the recording medium17.

A detection unit18detects whether the recording medium17can be inserted/removed (e.g., the open/closed state of a lid provided for a slot to mount the recording medium17) and insertion/removal of the recording medium17into/from the slot and notifies a controller15of the information. The controller15performs power supply control and controls access to the recording medium in accordance with information from the detection unit18or information set in the camera. InFIG. 1, the detection unit18is arranged separately from the file system unit16. However, the detection unit18may constitute a part of the file system unit16.

FIG. 2is a flowchart for explaining the access control operation of the digital camera according to the first embodiment. In this embodiment, a state wherein the recording medium can be inserted/removed is detected by detecting the open/closed state of the lid for the recording medium.

Step S201: For example, when a request for access to the recording medium17(write request) such as recording of photographed image data is issued in an image playback process, photographing process by pressing the release button of the operation unit14, or the like, the controller15starts accessing the recording medium17using the file system unit16.

Step S202: The detection unit18monitors the open/closed state of the lid of the slot for mounting the recording medium17. When the lid is kept closed, the file system unit16continues to access the recording medium17.

Step S203: When the detection unit18detects in step S202that the lid of the slot for mounting the recording medium17is opened, the controller15instructs the file system unit16to suspend accessing the recording medium17. The open state of the lid is made known by displaying a message, icon, or the like on a monitor unit13or outputting voice, an alarm, or the like.

At the time of suspension, data write is assumed to have ended with data written up to that time. EOF data is written to the end of data of a cluster being written, and file management information including the data size and FAT information is written. In other words, data write is suspended such that actually written data is consistent with the file management information for the written data. Accordingly, as for at least data written before the stop, the consistency between actually written-data and the file management information is maintained. A writing suspension process is started not after the recording medium is actually removed but when a state wherein the recording medium can be removed is detected. For this reason, even if the recording medium is actually. removed, the suspension process will have already ended, thereby preventing a conventional problem.

At the time of suspension, write is not ended immediately. Various methods (e.g., a method of ending write after a cluster being written has been fully written) can be adopted. Basically, write at the time of suspension may be stopped at an arbitrary timing as far as the suspension process ends within a time period necessary to actually remove the recording medium from when it is detected that the recording medium is ready to be removed (or operation of setting the recording medium in a removable state is performed).

At the time of suspension, information for correctly performing processing when the write process is resumed is stored. For example, the remaining image data and information indicating that write is suspended are temporarily saved in a memory (not shown).

Step S204: If the detection unit18detects that the lid of the slot for mounting the recording medium17is open while access to the recording medium17is suspended, the flow shifts to step S205. On the other hand, if it is detected that the lid is closed, the memory is referred to. When the write is suspended, the flow shifts to step S201to resume accessing the recording medium17.

At the time of the resumption of access, image data remaining in the memory is added to a file in which data has been written halfway.

Step S205: If the detection unit18detects that the recording medium17is removed while access to the recording medium17is suspended, the controller15instructs a power controller (not shown) to power off the camera. At this time, before power-off, the monitor unit13may be notified of a message or the like representing that image data photographed (or copied or moved from another recording medium) last is written only halfway.

According to this embodiment, when it is detected during write to a recording medium that the recording medium is ready to be removed, the data write is normally ended. Even if the recording medium is removed after that, the contents of file management information and those of actually written data are kept consistent with each other.

If the recording medium is not removed, and the removable state of the recording medium becomes undetected, write is resumed. This makes it possible to certainly record data to be written to the last.

Second Embodiment

The access control operation of a digital camera according to the second embodiment of the present invention will be described with reference to the flowchart shown inFIG. 3. The digital camera according to this embodiment can use a plurality of recording media (to be simply referred to as cards hereinafter) as recording media17.

For the sake of descriptive simplicity, a case will be described wherein two recording media (the first card and second card) can be used, and the first card is accessed. Similarly to the first embodiment, the removable state of each recording medium is detected by detecting the open/closed state of a lid which covers a slot in which the recording medium is mounted. In this example, a lid which covers a slot (the first slot) in which the first card is mounted and one which covers a slot (the second slot) in which the second card is mounted are one and the same.

Step S301: For example, when a request for access to the recording medium17(write request) such as recording of photographed image data is issued in an image reproduction process, photographing process by pressing a release button of an operation unit14, or the like, a controller15starts accessing the first card using a file system unit16.

Step S302: A detection unit18monitors the open/closed state of the lid of the slot for mounting the recording medium17. When the lid is closed, the file system unit16continues to access the first card.

Step S303: When the detection unit18detects in step S302that the lid of the slot for mounting the recording medium17is opened, the controller15instructs the file system unit16to suspend accessing the first card. The open state of the lid is made known by displaying a message, icon, or the like on a monitor unit13or outputting voice, an alarm, or the like.

A process to be performed at the time of suspension may be the same as that described in the first embodiment.

Step S304: If the detection unit18detects that the lid of the slot for mounting the recording medium17is open while access to the first card is suspended, the flow shifts to step S305. On the other hand, if it is detected that the lid is closed, the memory is referred to. When the write is suspended, the flow shifts to step S301to resume accessing the first card.

At the time of the resumption of access, image data remaining in the memory is added to a file in which data has been written halfway.

Step S305: It is checked whether the detection unit18detects that the first or second card is removed. If the detection unit18detects no removal, the flow returns to step S304. On the other hand, if any removal is detected, the flow shifts to step S306.

Step S306: It is checked whether the card being accessed is removed. More specifically, it is checked in this embodiment whether the detection unit18detects that the first card is removed. If removal of the first card is detected, the flow shifts to step S307. On the other hand, if removal of the second card is detected, the flow returns to step S304. No problem occurs even if a card other than one being accessed is removed.

Step S307: The controller15instructs a power controller (not shown) to power off the camera. At this time, before power off, the monitor unit13may be notified of a message or the like representing that image data photographed (or copied or moved from another recording medium) last is written only halfway.

For the sake of descriptive simplicity, this embodiment has described a case wherein two recording media are used. The present invention can also be applied to the case of three or more recording media.

Third Embodiment

The access control operation of a digital camera according to the third embodiment of the present invention will be described with reference to the flowchart shown inFIG. 4. The digital camera according to this embodiment can use a plurality of recording cards as recording media17, similarly to the second embodiment. In the second embodiment, write to the first card is independent of write to the second card. This embodiment is different from the second embodiment in that the second card is used as a backup for the first card. More specifically, simultaneously with write to the first card, backup data is written to the second card. A case will be described wherein the priority of the second card serving as the backup is set higher than that of the first card, and protection of the second card is placed at the highest priority. Such setting is implemented by the user using, e.g., a GUI. The setting is stored in a nonvolatile memory (not shown) together with other settings.

In this embodiment, for the sake of descriptive simplicity, the removable state of each recording medium is detected by detecting the open/closed state of a lid which covers a slot in which the recording medium is mounted, similarly to the first and second embodiments. In this embodiment, a lid which covers a slot (the first slot) in which the first card is mounted and one which covers a slot (the second slot) in which the second card is mounted are separately provided.

Step S401: For example, when a request for access to the recording media17(write request) such as recording of photographed image data is issued in an image reproduction process, photographing process by pressing a release button of an operation unit14, or the like, a controller15starts accessing the first and second cards using a file system unit16.

Step S402: A detection unit18monitors the open/closed states of the lids of the first and second slots. When the lids are kept closed, the file system unit16continues to access the first and second cards. If it is detected that either lid is open, the flow shifts to step S403.

Step S403: If the lid of the first slot corresponding to the first card having lower priority is detected to be open, no operation is performed, and the flow shifts to step S401to continue access. On the other hand, if the lid of the second slot corresponding to the second card having higher priority is detected to be open, the flow shifts to step S404.

Step S404: The controller15instructs the file system unit16to suspend accessing the second card. The open state of the lid of the second slot is made known by displaying a message, icon, or the like on a monitor unit13or outputting voice, an alarm, or the like. The access suspension process for the second card may be the same as that described in the first embodiment.

Step S405: If the detection unit18detects that the lid of the second slot is open while accessing the second card is suspended, the flow shifts to step S406. On the other hand, if it is detected that the lid is closed, the memory is referred to. When the write is suspended, the flow shifts to step S401to resume accessing the second card.

At the time of the resumption of accessing, image data remaining in the memory is added to a file in which data has been written halfway.

Step S406: It is checked whether the detection unit18detects that the second card is removed while access to the second card is suspended. If the detection unit18does not detect that the second card is removed, the flow returns to step S405. On the other hand, if the detection unit18detects that the second card is removed, the flow shifts to step S407.

Step S407: The controller15instructs a power controller (not shown) to power off the camera. At this time, before power-off, the monitor unit13may be notified of a message or the like representing that as for image data photographed (or copied or moved from another recording medium) last, at least recording of a backup has not normally ended.

As described above, the access suspension process is not performed for the first card having lower priority even if the lid of the first slot is opened. For this reason, write to the first card has probably ended at the time of power-off in step S407unless the first card is removed halfway during the write. However, it is preferable to confirm the written state of the first card before power-off, wait for the end of write if the write is in progress, and perform power-off.

As described above, according to this embodiment, if a plurality of recording media can be used, different access control processes can be performed depending on the priority. Significance-based data protection can be performed.

If backup recording is to be performed by an arrangement in which a plurality of slots share a lid, like the digital camera according to the second embodiment, the process for the second card (having higher priority) may be performed for all cards, regardless of the priorities set for the respective cards. A recording medium serving as a backup can be set to any one, and the priority setting can arbitrarily be performed.

Fourth Embodiment

The above-mentioned embodiments have been described while paying attention to removal of a recording medium being written. As described above, inconsistency between data and file management information may be caused even by a reduction in power supply voltage.

This embodiment eliminates inconsistency between data and file management information caused by a reduction in power supply voltage during data write.

FIG. 5is a block diagram showing an arrangement example of a digital camera as an example of an image input apparatus according to this embodiment. The same reference numerals inFIG. 5denote the same parts as those inFIG. 1. The digital camera according to this embodiment is the same as that according to the first embodiment except that a detection unit18monitors the voltage of a power supply19such as a primary cell, secondary cell, or the like and notifies a controller15if the voltage becomes lower than a predetermined voltage. A repetitive description will be omitted.

The access control operation of this embodiment will be described with reference to the flowchart shown inFIG. 6.

Step S601: For example, when a request for access to a recording medium17(write request) such as recording of photographed image data is issued in an image reproduction process, photographing process by pressing a release button of an operation unit14, or the like, a controller15starts accessing the recording medium17using a file system unit16.

Step S602: The detection unit18monitors the voltage of the power supply19. If the voltage is equal to or more than the predetermined voltage, the file system unit16continues to access the recording medium17. If the detection unit18detects that the voltage becomes lower than the predetermined voltage, the flow shifts to step S603.

Step S603: If the detection unit18detects in step S602that the voltage of the power supply19lowers, the controller15instructs the file system unit16to suspend accessing the recording medium17. A reduction in power supply voltage is made known by displaying a message, icon, or the like on a monitor unit13or outputting voice, an alarm, or the like.

A process to be performed at the time of suspension may be the same as that described in the first embodiment.

Step S604: When the suspension process ends, the camera is powered off in step S604.

As described above, according to this embodiment, if it is determined that the write process may be disabled halfway due to a reduction in power supply voltage, the data write is suspended (is made to normally end with data written up to that time). This maintains the consistency between the contents of file management information and those of actually written data.

The access control according to the fourth embodiment can be implemented in combination with that in the first to third embodiments.

Other Embodiments

The first to third embodiments have described a case wherein the removable state of each recording medium is detected by the open closed state of a lid provided for a slot to mount the recording medium. The removable state can be detected by any other method. More specifically, the effects of the present invention can be implemented by performing the access control process using any state change before the recording medium is actually removed. For example, in an apparatus in which a memory card is removed from a slot by pressing a lever, the start of lever press may be detected, and an access suspension process may be performed upon the detection.

The above-mentioned embodiments have described only a digital camera comprising a single device. Equivalent functions may be implemented by a system comprising a plurality of devices. For example, equivalent functions can be implemented by a general-purpose computer device to which a memory card reader/writer and camera are connected. Note that an image sensing unit11and image processor12are not essential to the present invention, and data prepared in advance may be written to a recording medium.

In this case, so long as the system or apparatus has the functions of the program, the program may be executed in any form, such as an object code, a program executed by an interpreter, or scrip data supplied to an operating system.

CLAIM OF PRIORITY

This application claims priority from Japanese Patent Application No. 2003-417238 filed on Dec. 15, 2003, which is hereby incorporated by reference herein.