Updated some files, fixed #1, added mimetype recognition for the depth map
This commit is contained in:
parent
18f6e4e13f
commit
34f16eb4f9
8 changed files with 60 additions and 28 deletions
18
src/JPEG.java
Normal file → Executable file
18
src/JPEG.java
Normal file → Executable file
|
@ -1,5 +1,6 @@
|
|||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class JPEG extends Const
|
||||
{
|
||||
|
@ -74,14 +75,19 @@ public class JPEG extends Const
|
|||
}
|
||||
|
||||
/**
|
||||
* extract the depth map from the jpeg and store it in the same location as the jpeg itself but with the suffix _d.png
|
||||
* extract the depth map from the jpeg and store it in the same location as the jpeg itself
|
||||
* but with the suffix '_d' and filetype suffix (jpg or png)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean exportDepthMap()
|
||||
{
|
||||
String out = m_Filename;
|
||||
if (out.endsWith(".jpg") || out.endsWith(".JPG")) out = out.substring(0, out.length()-4);
|
||||
if (out.endsWith(".jpg") || out.endsWith(".JPG"))
|
||||
out = out.substring(0, out.length()-4);
|
||||
String mime = extractDepthMapMIMEType();
|
||||
if(mime != null && mime.equals(Const.mimeJPG))
|
||||
return this.exportDepthMap(out+"_d.jpg");
|
||||
return this.exportDepthMap(out+"_d.png");
|
||||
}
|
||||
|
||||
|
@ -140,6 +146,14 @@ public class JPEG extends Const
|
|||
{
|
||||
return JPEGUtils.extractDepthMap(m_RawData);
|
||||
}
|
||||
|
||||
public String extractDepthMapMIMEType()
|
||||
{
|
||||
byte[] mime = JPEGUtils.extract(m_RawData, Const.keyGDepthMIME);
|
||||
if (mime != null) return new String(mime);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract and return the unblurred source image
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue