|
摄像头如何把200W像素差值到500W像素甚至800W像素。或者其它一些像素的差值。Camera插值在底层已经做好,我们只需要在中间层和app层添加一个对应的picture size即可。但是有一些限制条件需要注意:
1. 插值的倍数只能小于等于8倍,也就是说假如是1M的sensor,那最多只能插值到8M;
2. 目前最大只能插值到12M,也就是插值的上限是12M;
3. 由于硬件的bandwidth限制,若sensor是8M或者是插值到8M,需要将底层rotate image的feature关闭(JB版本默认是开启的),否则会出现拍照异常的现象(如拍照图片分屏、拍照图片无法保存、拍照图片为空等)。
PS:若您对于底层rotate image的feature不是很了解的话,可以参考FAQ中Camera Framework&mhal类别下的FAQ04053
下面是关于插值的方法:
(一)中间层修改
1.\mediatek\custom\project_name\hal\camera\camera\cfg_ftbl_custom_raw_main.h
( 若为 yuv sensor则修改:cfg_ftbl_custom_yuv_main.h;
若为 raw sensor则修改:cfg_ftbl_custom_raw_main.h )
在如下定义capture size的地方增加您想要的size,如果已经包含你要加的size,就不需要再增加
#if 1
// Capture Size
CONFIG_FEATURE(FID_CAP_SIZE,
BY_DEFAULT(CAPTURE_SIZE_2560_1920),
CAPTURE_SIZE_320_240, CAPTURE_SIZE_640_480,
CAPTURE_SIZE_1024_768, CAPTURE_SIZE_1280_960,
CAPTURE_SIZE_1600_1200, CAPTURE_SIZE_2048_1536,
CAPTURE_SIZE_2560_1920
)
#endif
例如:
#if 1
// Capture Size
CONFIG_FEATURE(FID_CAP_SIZE,
BY_DEFAULT(CAPTURE_SIZE_4000_3000),
CAPTURE_SIZE_320_240, CAPTURE_SIZE_640_480,
CAPTURE_SIZE_1024_768, CAPTURE_SIZE_1280_960,
CAPTURE_SIZE_1600_1200, CAPTURE_SIZE_2048_1536,
CAPTURE_SIZE_2560_1920, CAPTURE_SIZE_3264_2448,
CAPTURE_SIZE_4096_3072
)
#endif
2. \mediatek\custom\common\kernel\imgsensor\inc\kd_camera_feature_enum.h
在如下定义capture size的enum里增加您想要的size,如果已经包含你要加的size,就不需要再增加
// Capture Size
FID_TO_TYPE_ENUM (
FID_CAP_SIZE,
FTYPE_ENUM (
CAPTURE_SIZE_BEGIN = 0,
CAPTURE_SIZE_320_240 = CAPTURE_SIZE_BEGIN,
CAPTURE_SIZE_640_480,
CAPTURE_SIZE_1024_768,
CAPTURE_SIZE_1280_960,
CAPTURE_SIZE_1600_1200,
CAPTURE_SIZE_2048_1536,
CAPTURE_SIZE_2560_1920,
CAPTURE_SIZE_3264_2448,
CAPTURE_SIZE_4096_3072,
NUM_OF_CAPTURE_SIZE
)
) CAPTURE_SIZE_T;
3. mt6575_JellyBean版本:
\mediatek\platform\mt6575\hardware\camera\hal\camadapter\mhal\ mHalCamParameters.cpp
mt6577_JellyBean版本:
\mediatek\platform\mt6577\hardware\camera\hal\camadapter\mhal\ mHalCamParameters.cpp
修改这两个地方,增加您想要的size,如果已经包含你要加的size,就不需要再增加
int picSizes[] = {
CAPTURE_SIZE_4096_3072, CAPTURE_SIZE_3264_2448, CAPTURE_SIZE_2560_1920, CAPTURE_SIZE_2048_1536, CAPTURE_SIZE_1600_1200, CAPTURE_SIZE_1280_960,
CAPTURE_SIZE_1024_768, CAPTURE_SIZE_640_480, CAPTURE_SIZE_320_240};
const char *ppicSizes[] = {
“4096x3072”,"3264x2448", "2560x1920", "2048x1536", "1600x1200", "1280x960", "1024x768",
"640x480", "320x240"};
(二) app层的修改可以按照如下来修改:
1.\packages\apps\Camera\res\values\strings.xml
增加您想要的size,如果已经包含您要加的size,就不需要再增加
<string name="pref_camera_picturesize_entry_3264x2448">8M pixels</string>
<string name="pref_camera_picturesize_entry_2592x1936">5M pixels</string>
<string name="pref_camera_picturesize_entry_2048x1536">3M pixels</string>
<string name="pref_camera_picturesize_entry_1600x1200">2M pixels</string>
<string name="pref_camera_picturesize_entry_1280x960">1.3M pixels</string>
<string name="pref_camera_picturesize_entry_1024x768">1M pixels</string>
<string name="pref_camera_picturesize_entry_640x480">VGA</string>
<string name="pref_camera_picturesize_entry_320x240">QVGA</string>
例如:
<string name="pref_camera_picturesize_entry_4096x3072">12M Pixels</string>
<string name="pref_camera_picturesize_entry_3264x2448">8M pixels</string>
<string name="pref_camera_picturesize_entry_2592x1936">5M pixels</string>
<string name="pref_camera_picturesize_entry_2048x1536">3M pixels</string>
<string name="pref_camera_picturesize_entry_1600x1200">2M pixels</string>
<string name="pref_camera_picturesize_entry_1280x960">1.3M pixels</string>
<string name="pref_camera_picturesize_entry_1024x768">1M pixels</string>
<string name="pref_camera_picturesize_entry_640x480">VGA</string>
<string name="pref_camera_picturesize_entry_320x240">QVGA</string>
2.\packages\apps\Camera\res\values\arrays.xml
<string-array name="pref_camera_picturesize_entries" translatable="false">
<!-- TODO: Change to a better name of the preference.
The first element of the array should be
"pref_camera_picturesize_entry_2592x1944". However, we are too
late for the translation. Since we show the same label as the
second item, we just use the second one instead.
-->
<item>@string/pref_camera_picturesize_entry_3264x2448</item>
<item>@string/pref_camera_picturesize_entry_2592x1936</item>
<item>@string/pref_camera_picturesize_entry_2592x1936</item>
<item>@string/pref_camera_picturesize_entry_2592x1936</item>
<item>@string/pref_camera_picturesize_entry_2048x1536</item>
<item>@string/pref_camera_picturesize_entry_1600x1200</item>
<item>@string/pref_camera_picturesize_entry_1280x960</item>
<item>@string/pref_camera_picturesize_entry_1024x768</item>
<item>@string/pref_camera_picturesize_entry_640x480</item>
<item>@string/pref_camera_picturesize_entry_320x240</item>
</string-array>
增加您想要的size,如果已经包含您要加的size,就不需要再增加
例如:
<string-array name="pref_camera_picturesize_entries" translatable="false">
<!-- TODO: Change to a better name of the preference.
The first element of the array should be
"pref_camera_picturesize_entry_2592x1944". However, we are too
late for the translation. Since we show the same label as the
second item, we just use the second one instead.
-->
<item>@string/pref_camera_picturesize_entry_4096x3072</item>
<item>@string/pref_camera_picturesize_entry_3264x2448</item>
<item>@string/pref_camera_picturesize_entry_2592x1936</item>
<item>@string/pref_camera_picturesize_entry_2592x1936</item>
<item>@string/pref_camera_picturesize_entry_2592x1936</item>
<item>@string/pref_camera_picturesize_entry_2048x1536</item>
<item>@string/pref_camera_picturesize_entry_1600x1200</item>
<item>@string/pref_camera_picturesize_entry_1280x960</item>
<item>@string/pref_camera_picturesize_entry_1024x768</item>
<item>@string/pref_camera_picturesize_entry_640x480</item>
<item>@string/pref_camera_picturesize_entry_320x240</item>
</string-array>
3.\packages\apps\Camera\res\values\arrays.xml
<string-array name="pref_camera_picturesize_entryvalues" translatable="false">
<item>3264x2448</item>
<item>2592x1944</item>
<item>2592x1936</item>
<item>2560x1920</item>
<item>2048x1536</item>
<item>1600x1200</item>
<item>1280x960</item>
<item>1024x768</item>
<item>640x480</item>
<item>320x240</item>
</string-array>
增加您想要的size,如果已经包含你要加的size,就不需要再增加
例如:
<string-array name="pref_camera_picturesize_entryvalues" translatable="false">
<item>4096x3072</item>
<item>3264x2448</item>
<item>2592x1944</item>
<item>2592x1936</item>
<item>2560x1920</item>
<item>2048x1536</item>
<item>1600x1200</item>
<item>1280x960</item>
<item>1024x768</item>
<item>640x480</item>
<item>320x240</item>
</string-array>
4.packages\apps\Camera\res\values\arrays.xml
<!-- when smile shot mode, just following items are enables -->
<string-array name="pref_camera_picturesize_for_smileshot_entryvalues" translateble="false">
<item>3264x2448</item>
<item>2592x1944</item>
<item>2560x1920</item>
<item>2048x1536</item>
<item>1600x1200</item>
<item>1280x960</item>
<item>1024x768</item>
<item>640x480</item>
</string-array>
增加您想要的size,如果已经包含你要加的size,就不需要再增加
例如:
<!-- when smile shot mode, just following items are enables -->
<string-array name="pref_camera_picturesize_for_smileshot_entryvalues" translateble="false">
<item>4096x3072</item>
<item>3264x2448</item>
<item>2592x1944</item>
<item>2560x1920</item>
<item>2048x1536</item>
<item>1600x1200</item>
<item>1280x960</item>
<item>1024x768</item>
<item>640x480</item>
</string-array>
PS:另外再附上关掉rotate image的feauture的方法:
代码文件
mediatek\platform\mt6577\hardware\camera\hal\Camadapter\mhal\ mHalCamAdapter.cpp
将status_t MTKCameraHardware::takePictureInternal()方法中的
原来的:
if (mu4ShotMode == MHAL_CAM_CAP_MODE_CONTINUOUS_SHOT ||
false == NSCamCustom::isSupportJpegOrientation()
)
{
mmHalCamParam.camExifParam.orientation = mParameters.getInt(MtkCameraParameters::KEY_ROTATION);
mmHalCamParam.u4JPEGOrientation = 0;
}
else
{
mmHalCamParam.camExifParam.orientation = 0;
mmHalCamParam.u4JPEGOrientation = mParameters.getInt(MtkCameraParameters::KEY_ROTATION) / 90;
if (mmHalCamParam.u4JPEGOrientation != 0)
{
mmHalCamParam.u4DumpYuvData = 1;
}
}
修改为:
mmHalCamParam.camExifParam.orientation = mParameters.getInt(MtkCameraParameters::KEY_ROTATION);
mmHalCamParam.u4JPEGOrientation = 0;
更多 0
|
|