3wwang的2019计划

博主3wwang分享了深入研究osg类生物、osg设计模式、osgExamples、osgBullet库、osg与HoloLens结合、osgEarth及其应用的系列文章,详细解析了osg相关的技术与应用场景。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、探究osg类生物----系列(35天) 已完结

       【置顶】探索未知种族之osg类生物【目录】​www.3wwang.cn

2、osg中的设计模式---系列(15天) 已完结

       【置顶】探究osg中的程序设计模式【目录】

3、osgExamples讲解(挑出一部分用opengl实现)---系列(40天) 创作中

      【置顶】OSG3.4内置Examples解析【目录】

 

4、探究osgBullet库----系列 (30天) 等待中

  • Bullet库简介
  • osg与bullet结合
  • 碰撞检测示例
  • 添加重力示例

       3wwang个人博客-记录走过的技术之路​www.3wwang.cn

5、osg与HoloLens结合----系列 (30天) 等待中

polsar2rgb函数是用于将极化合成孔径雷达(PolSAR)数据转换为RGB图像的MATLAB函数。下面是一个示例程序,展示如何编写polsar2rgb函数: ```matlab function RGB = polsar2rgb(data, mode) % polsar2rgb - convert PolSAR data to RGB image % % Inputs: % data: PolSAR data (M x N x 4) % mode: conversion mode (string) % &#39;Lee&#39; - Lee et al. (2009) polarimetric color mapping % &#39;Krogager&#39; - Krogager et al. (2017) polarimetric color mapping % % Output: % RGB: RGB image (M x N x 3) % % Example: % data = imread(&#39;polsar.tif&#39;); % RGB = polsar2rgb(data, &#39;Lee&#39;); % imshow(RGB); % % Author: Wei Wang (wwang@surrey.ac.uk) % Date: 02-Feb-2021 if nargin < 2 mode = &#39;Lee&#39;; end if size(data, 3) ~= 4 error(&#39;Input data must be PolSAR data (M x N x 4)&#39;); end if strcmp(mode, &#39;Lee&#39;) % Lee et al. (2009) polarimetric color mapping S11 = data(:, :, 1); S12_real = data(:, :, 2); S12_imag = data(:, :, 3); S22 = data(:, :, 4); RGB = zeros(size(data, 1), size(data, 2), 3); % compute intensity I = (abs(S11) + abs(S22)) / 2; I = I / max(I(:)); % compute hue H = atan2(S12_imag, S12_real); H = mod(H, 2*pi) / (2*pi); % compute saturation S = abs(S11 - S22) ./ (abs(S11) + abs(S22)); S(isnan(S) | isinf(S)) = 0; % convert HSI to RGB for i = 1:size(data, 1) for j = 1:size(data, 2) RGB(i, j, :) = hsi2rgb(H(i, j), S(i, j), I(i, j)); end end elseif strcmp(mode, &#39;Krogager&#39;) % Krogager et al. (2017) polarimetric color mapping % TODO: implement the algorithm error(&#39;Krogager et al. (2017) polarimetric color mapping is not implemented yet&#39;); else error(&#39;Unknown conversion mode&#39;); end end function RGB = hsi2rgb(H, S, I) % hsi2rgb - convert HSI color space to RGB color space % % Inputs: % H: hue (0~1) % S: saturation (0~1) % I: intensity (0~1) % % Output: % RGB: RGB color (0~1) % % Reference: % R. W. G. Hunt, "The Reproduction of Colour", 6th edition, John Wiley & % Sons, 2004. % % Author: Wei Wang (wwang@surrey.ac.uk) % Date: 02-Feb-2021 if H < 1/3 B = I * (1 - S); R = I * (1 + (S * cos(2*pi*H)) / cos(pi/3 - 2*pi*H)); G = 3*I - (R + B); elseif H < 2/3 H = H - 1/3; R = I * (1 - S); G = I * (1 + (S * cos(2*pi*H)) / cos(pi/3 - 2*pi*H)); B = 3*I - (R + G); else H = H - 2/3; G = I * (1 - S); B = I * (1 + (S * cos(2*pi*H)) / cos(pi/3 - 2*pi*H)); R = 3*I - (G + B); end RGB = [R, G, B]; end ``` 在这个程序中,我们定义了一个名为`polsar2rgb`的函数,它接受两个输入参数:`data`和`mode`。`data`是一个 M x N x 4 的数组,其中包含了 PolSAR 数据。`mode`是一个字符串,可以是 `&#39;Lee&#39;` 或 `&#39;Krogager&#39;`,表示要使用哪种色彩映射算法。 在函数的主体中,我们首先对输入参数进行了一些验证。然后,根据所选的色彩映射算法,将 PolSAR 数据转换为 RGB 图像。如果选择 Lee et al. (2009) 的算法,我们首先根据式子计算出强度(I)、色调(H)和饱和度(S),然后使用`hsi2rgb`函数将 HSI 颜色空间转换为 RGB 颜色空间。如果选择 Krogager et al. (2017) 的算法,则需要实现该算法的代码。 最后,我们还定义了一个名为`hsi2rgb`的子函数,它将 HSI 颜色空间转换为 RGB 颜色空间。该函数根据 Hunt (2004) 的书籍给出的公式进行计算。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值