小编Kas*_* DK的帖子

从3d透视重绘图像到2d

我需要用Pascal/Delphi/Lazarus编写的逆透视变换.见下图:

图像处理

我想我需要遍历目标像素,然后计算源图像中的相应位置(以避免舍入错误等问题).

function redraw_3d_to_2d(sourcebitmap:tbitmap, sourceaspect:extended, point_a, point_b, point_c, point_d:tpoint, megapixelcount:integer):tbitmap;
var
   destinationbitmap:tbitmap;
   x,y,sx,sy:integer;
begin
  destinationbitmap:=tbitmap.create;
  destinationbitmap.width=megapixelcount*sourceaspect*???; // I dont how to calculate this
  destinationbitmap.height=megapixelcount*sourceaspect*???; // I dont how to calculate this
  for x:=0 to destinationbitmap.width-1 do
    for y:=0 to destinationbitmap.height-1 do
    begin
        sx:=??;
        sy:=??;
        destinationbitmap.canvas.pixels[x,y]=sourcebitmap.canvas.pixels[sx,sy];
    end;
  result:=destinationbitmap;
end;
Run Code Online (Sandbox Code Playgroud)

我需要真正的公式......所以OpenGL解决方案并不理想......

delphi math geometry pascal lazarus

17
推荐指数
2
解决办法
4767
查看次数

在PHP中使用IMAP获取唯一的电子邮件ID

如何为IMAP帐户中的每封电子邮件计算唯一ID字符串?

我正在编写一个脚本,必须经常将所有丢失的邮件从一个IMAP帐户复制到另一个帐户.我想避免在每次更新时都重复,因此我必须确定一个帐户上的内容以及另一个帐户上的内容.

并非所有的电子邮件有一个message_id,我看不出之间的区别是什么message_id以及uid是-任何人可以告诉我吗?

在我看来,message_id使用imap_append时没有改变- 任何人都可以确认吗?

为每封电子邮件生成唯一的ID字符串时,除了消息ID,fx电子邮件标题和日期之外还有许多其他选项,但我不知道该选择什么:http: //www.php.net/manual/en/ function.imap-headerinfo.php

php imap

7
推荐指数
2
解决办法
5120
查看次数

从网址中删除所有空值

我想从网址中删除所有空值:

var s="value1=a&value2=&value3=b&value4=c&value5=";
s = s.replace(...???...);
alert(s);
Run Code Online (Sandbox Code Playgroud)

预期产量:

value1=a&value3=b&value4=c
Run Code Online (Sandbox Code Playgroud)

我只需要考虑URL的查询部分.

javascript regex preg-replace

5
推荐指数
1
解决办法
2014
查看次数

生成用于 YouTube 搜索的 url

如何使用 javascript 或 php 为 youtube 生成一个 url,用于搜索特定用户帐户上的视频,并在顶部显示最佳标题匹配?

我正在使用这段代码:

<!DOCTYPE html>
<head>
    <meta charset="utf-8" />
</head>

<script type="text/javascript">
    function mysearch()
    {
        var elem=document.getElementById('inputsearchquery');
        var url="http://www.youtube.com/user/QueenVEVO/videos?query="+encodeURIComponent(elem.value);
        var win=window.open(url, '_blank');
        win.focus();
    }
</script>

<body>
    <h2>Enter search string (user: Queen)</h2>
    <input id="inputsearchquery" type="text" value="the show must go on">
    <button type="button" onclick="mysearch()">Search</button>
</body>
Run Code Online (Sandbox Code Playgroud)

唯一的问题是 YouTube 没有将最佳标题匹配放在顶部!视频《演出必须继续》排在第 13 位,我以为它会排在第一位?

谁能告诉我如何更改网址,以便 YouTube 将最佳标题匹配放在顶部?或者我真的必须使用 youtube api 来完成此任务吗?

javascript youtube

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

javascript ×2

delphi ×1

geometry ×1

imap ×1

lazarus ×1

math ×1

pascal ×1

php ×1

preg-replace ×1

regex ×1

youtube ×1