产生原因

校正方法

代码

PINTO算法
readRAW

function rawData = readRaw(fileName, bitsNum, row, col)
% readRaw.m    get rawData from HiRawImage
%   Input:
%       fileName    the path of HiRawImage
%       bitsNum      the number of bits of raw image
%       row         the row of the raw image
%       col         the column of the raw image
%   Output:
%       rawData     the matrix of raw image data
%   Instructions:
%       author:     wtzhu
%       e-mail:     wtzhu_13@163.com
% Last Modified by wtzhu v1.0 2021-06-29
% Note: % get fileID
fin = fopen(fileName, 'r');
% format precision
switch bitsNumcase 8disp('bits: 8');format = sprintf('uint8=>uint8');case 10disp('bits: 10');format = sprintf('uint16=>uint16');case 12disp('bits: 12');format = sprintf('uint16=>uint16');case 16disp('bits: 16');format = sprintf('uint16=>uint16');
end
I = fread(fin, row*col, format);
% plot(I, '.');
z = reshape(I, row, col);
z = z';
rawData = z;
% imshow(z);
end

judgeDefectPixel

function correctP = judgeDefectPixel(aroundP, currentP, Th)
% judgeDefectPixel.m    correct the curren pixel
%   Input:
%       aroundP     the pixel around the current pixel
%       currentP    the value of current pixel
%       Th          the threshold of the defect pixel
%   Output:
%       correctP    the corrected value of the pixel
%   Instructions:
%       author:     wtzhu
%       e-mail:     wtzhu_13@163.com
% Last Modified by wtzhu v1.0 2021-07-16
% Note: % get the median value of the around listmedianV = median(aroundP);% get the difference between the around pixel and the current pixeldiff = aroundP - ones(1, numel(aroundP)) * currentP;% if all difference bigger than 0 or all smaller than 0 and all abs of the diff are bigger than Th, that pixel is% a defect pixel and replace it with the median;if (nnz(diff > 0) ==  numel(aroundP)) || (nnz(diff < 0) ==  numel(aroundP))if length(find((abs(diff)>Th)==1)) == numel(aroundP)correctP = medianV;elsecorrectP = currentP;endelsecorrectP = currentP;end
end

expanRAW

function imgExpand = expandRaw(img, expandNum)
if mod(expandNum, 2) ~= 0disp('expandNum must be an even number!')return
end
[height, width] = size(img);
imgExpand = zeros(height+expandNum*2, width+expandNum*2);
imgExpand(expandNum+1:height+expandNum, expandNum+1:width+expandNum) = img(:,:);
imgExpand(1:expandNum, expandNum+1:width+expandNum) = img(1:expandNum,:);
imgExpand(height+expandNum+1:height+expandNum*2, expandNum+1:width+expandNum) = img(height-expandNum+1:height,:);
imgExpand(:,1:expandNum) = imgExpand(:, expandNum+1:2*expandNum);
imgExpand(:,width+expandNum+1:width+2*expandNum) = imgExpand(:, width+1:width+expandNum);
end

photo

clc;clear;close all;
tic;
% --------global velue---------
expandNum = 2;
Th = 30;% --------raw parameters-------
filePath = 'images/HisiRAW_4208x3120_8bits_RGGB.raw';
bayerFormat = 'RGGB';
bayerBits = 8;
row = 4208;
col = 3120;
% -----------------------------rawData = readRaw(filePath, bayerBits, row, col);
[height, width, channel] = size(rawData);img_expand = expandRaw(rawData, expandNum);disImg = zeros(height, width);
for i = expandNum+1 : 2 : height+expandNumfor j = expandNum+1 : 2 : width+expandNum% R% get the pixel around the current R pixelaround_R_pixel = [img_expand(i-2, j-2) img_expand(i-2, j) img_expand(i-2, j+2) img_expand(i, j-2) img_expand(i, j+2) img_expand(i+2, j-2) img_expand(i+2, j) img_expand(i+2, j+2)];disImg(i-expandNum, j-expandNum) = judgeDefectPixel(around_R_pixel, img_expand(i, j), Th);% Gr% get the pixel around the current Gr pixelaround_Gr_pixel = [img_expand(i-1, j) img_expand(i-2, j+1) img_expand(i-1, j+2)  img_expand(i, j-1) img_expand(i, j+3) img_expand(i+1, j) img_expand(i+2, j+1) img_expand(i+1, j+2)];disImg(i-expandNum, j-expandNum+1) = judgeDefectPixel(around_Gr_pixel, img_expand(i, j+1), Th);% B% get the pixel around the current B pixelaround_B_pixel = [img_expand(i-1, j-1) img_expand(i-1, j+1) img_expand(i-1, j+3) img_expand(i+1, j-1) img_expand(i+1, j+3) img_expand(i+3, j-1) img_expand(i+3, j+1) img_expand(i+3, j+3)];disImg(i-expandNum+1, j-expandNum+1) = judgeDefectPixel(around_B_pixel, img_expand(i+1, j+1), Th);% Gb% get the pixel around the current Gb pixelaround_Gb_pixel = [img_expand(i, j-1) img_expand(i-1, j) img_expand(i, j+1) img_expand(i+1, j-2) img_expand(i+1, j+2) img_expand(i+2, j-1) img_expand(i+3, j) img_expand(i+2, j+1)];disImg(i-expandNum+1, j-expandNum) = judgeDefectPixel(around_Gb_pixel, img_expand(i+1, j), Th);end
end
figure();
imshow(rawData);title('org');
figure();
imshow(uint8(disImg));title('corrected');
disp(['cost time��',num2str(toc)])

DPC(Defect Pixel Correction)——坏点检测相关推荐

  1. DPC(Defect Point Correction)------坏点校正

    所谓坏点,是指像素阵列中与周围像素点的变化表现出明显不同的像素,因为图像传感器是成千上万的元件工作在一起,因此出现坏点的概率很大.一般来讲,坏点分为三类:第一类是死点,即一直表现为最暗值的点:第二类是 ...

  2. isp 图像算法(二)之dead pixel correction坏点矫正

    代码在git 相机中的坏点就是那些和周围不一样的点,就是那些数值极大或者极小值点,你可以理解一张曲面的山峰或者山谷,人群中也是一样,那些与大众不一样的人就是"坏人",衡量好坏用他与 ...

  3. ISP——DPC(Defective Pixel Correction)

    现象 造成坏点的原因 感光元件芯片自身工艺技术瑕疵造成: 光线采集存在缺陷: 制造商产品差异: 坏点分类 hot pixel: 固定保持较高的像素值,一般呈现为画面高亮的点: dead pixel: ...

  4. ISP——坏点矫正(Defective Pixel Correction,DPC)

    文章目录 一.出现原因 二.坏点分类 三.矫正方法 动态矫正 1.PINTO算法 2.中值梯度滤波法 3.DPC和demosaic结合法 4.行检测法 四.代码 一.出现原因 1.感光元件芯片自身工艺 ...

  5. 硬盘坏道检测和修复(HDDL、MHDD、THDD、HDDSPEED)图文教程、下载

    硬盘出现了坏道,我们都希望能修好再用,可以省一笔银子,很多网友希望自己能够维修,免得被JS宰一刀,JS有PC3000.HRT等专业工具,似乎什么都能修,可实际下来的结果往往不是那样,可我们自己修更不理 ...

  6. 硬盘坏道检测和修复(HDDL、MHDD、THDD)图文教程

    硬盘坏道检测和修复(HDDL.MHDD.THDD)图文教程 dgisxazsc dgisxazsc 点击放大dgisxazsc dgisxazsc 还有一种情况就是用MHDD测试时开始可能全盘都没有坏 ...

  7. omv检查硬盘坏道_坏道检测与修复

    本软件提供了磁盘坏道检测功能及有限的坏道修复功能.为确保检查结果的准确性,建议在WinPE环境下进行检测,并且在检测坏道期间不要对磁盘做其他操作. 1. 要使用本功能,首先选择需要检测坏道的磁盘,然后 ...

  8. 屏幕坏点检测图片_【沙发管家】教你自己测试智能电视屏幕

    在很多用户的概念中,买电视最重要的就是看电视屏幕好不好,一般来说,屏幕越好电视所表现出来的画质也会越出色.然而在选购了新的电视机后,我们该如何保证拿到手的这台电视屏幕质量是过关的呢?没有专业测试工具的 ...

  9. linux磁盘坏块 cp报错,Linux磁盘坏道的检测及修复

    磁盘坏道,是所有人都不希望遇到的事情-- 磁盘坏道,轻则磁盘性能下降,重则系统启动失败,数据丢失.所以我们要时刻关注磁盘健康状况,及时备份重要数据. 什么是S.M.A.R.T? 全称为 Self-Mo ...

最新文章

  1. 使用python中的Matplotlib绘图示例(续)
  2. Django基础之Model创建表
  3. java stringtoarray_java中toArray()的用法
  4. 讲讲Bootstrap是在干啥?
  5. html/css学习笔记(一)
  6. 计算机硬盘的扇区大小,硬盘扇区编辑功能概述 - DiskGenius
  7. python学习笔记第四节
  8. PyQt5: This application failed to start because it could not find or load the Qt platform plugin
  9. 完整、详细的MySQL规范
  10. 安装福昕高级PDF编辑器提示安装错误解决办法
  11. 小米官网服务器维修无法刷机,小米手机无法刷机的解决方法
  12. VS2003 搜索直接导致卡死问题
  13. 为什么要升级PLM系统
  14. 第13届蓝桥杯省赛真题剖析-2022年4月17日Scratch编程初中级组
  15. webuploader上传文件夹总结
  16. R语言入门——NA、NAN、Inf(缺失值的识别)
  17. Unix/Linux编程:getcontext、setcontext
  18. 视频融合协议安防监控系统EasyCVR支持大华SDK接入设备录像下载流程说明
  19. Python批量下载Bilibili(B站)1080P60fps视频-pip打包安装
  20. 【因果推断与机器学习】Causal Inference: Chapter_2

热门文章

  1. 学习Less-看这篇就够了
  2. canvas 文字颜色_Canvas 超全教程
  3. 如何在不激活电脑的情况验机
  4. Python 绘制游戏窗口
  5. 网上电子元器件采购商城:打破采购环节信息不对称难题,赋能企业高效协同管理
  6. 用Liveupdata 刷MSI主板Slic 2.1
  7. 计算机文档排版考试,Word和WPS通用的文档排版技巧
  8. 计算机应用基础评价内容,计算机应用基础教学中过程性评价的研究
  9. 推荐一款非常好用的效率APP
  10. 单例模式java概括_单例模式中总有几个歪门邪道的问题要知道!