无法使用NodeJS和Redis进行SET / GET(Can't SET/GET with NodeJS and Redis)
我想为我的Etherpad编写一个ueberDB Redis处理程序。
我绝对不明白我的问题,因为使用PHP,我可以设置并获取没有任何问题的键/值。 它只适用于NodeJS。
这是一个示例代码:
var redis = require("redis"); client = redis.createClient(); client.on("error", function (err) { console.log("Error " + err); }); client.set("test", "string val", redis.print); console.log(client.get("test"));
我错了什么? 也许有人给我一个小费。
I want to write a ueberDB Redis-Handler for my Etherpad.
I absolutely do not understand my problem because with PHP I can set and get key/values without any problems. It only does not work with NodeJS.
Here is a example code:
var redis = require("redis"); client = redis.createClient(); client.on("error", function (err) { console.log("Error " + err); }); client.set("test", "string val", redis.print); console.log(client.get("test"));
What do I wrong? Maybe somebody has a tip for me.
原文:https://stackoverflow.com/questions/8364503
最满意答案
您必须在直方图中确定所需的箱数。 例如。 Matlab直方图函数采用这些形式
imhist(I)imhist(I,n)imhist(X,map)
在第一种情况下,默认情况下,bin的数量为256.因此,如果您有16位输入,这些将缩小为8位并分成256个bin直方图。
在第二个中,您可以指定箱数'n'。 假设您为16位数据指定n = 2。 然后,这将基本上将直方图分割为[0-2 ^ 15,2 ^ 15-2 ^ 16-1]。
第三种情况是您为每个bin指定映射。 即你必须指定每个bin的像素值范围。
http://www.mathworks.com/help/images/ref/imhist.html
您希望如何选择垃圾箱数量取决于您的要求。
You have to decide how many bins you need in the histogram. For eg. the Matlab histogram function takes these forms
imhist(I) imhist(I, n) imhist(X, map)
In the first case, the number of bins is by default used as 256. So, if you have 16bit input, these will be scaled down to 8 bit and split into 256 bin histogram.
In the second one, you can specify number of bins 'n'. Lets say you specify n=2 for your 16 bit data. Then, this will essentially split the histogram as [0-2^15, 2^15-2^16-1].
The third case is where you specify the map for each bin. ie you have to specify the ranges of the pixel values for each bin.
http://www.mathworks.com/help/images/ref/imhist.html
How you want to choose the number of bins depends on your requirement.
相关问答
更多-
好的,我找了几分钟。 下面,我介绍了四种解决方案,并提出了最糟糕的解决方案(中间两项,涉及O(n)数据转换)对您来说非常简单。 让我们承认愚蠢的解决方案 以明显的方式开始是合理的。 您可以使用Data.List.foldl遍历行和列,从初始的零数组构建直方图(未经测试/部分代码如下): foldl (\(histR, histG, histB) (row,col) -> let r = arr ! (Z:.row:.col:.0) g = arr ! ...
-
看起来您的本机部分上的opencv_imgproc248.dll库存在问题,而不是代码中存在问题。 It looks like you have a problem with your opencv_imgproc248.dll library on the native part, not in your code.
-
没有查询表: typedef unsigned long long u64; void sboxes(uchar aucData[6]) { u64 v = aucData[0] + (((u64)aucData[1]) << 8) + (((u64)aucData[2]) << 16) + (((u64)aucData[3]) << 24) + (((u64)aucData[4]) << 32) + (((u64)aucData[5]) << 40); ...
-
计算48位图像直方图(Calculating a 48-bit image histogram)[2024-01-24]
您必须在直方图中确定所需的箱数。 例如。 Matlab直方图函数采用这些形式 imhist(I)imhist(I,n)imhist(X,map) 在第一种情况下,默认情况下,bin的数量为256.因此,如果您有16位输入,这些将缩小为8位并分成256个bin直方图。 在第二个中,您可以指定箱数'n'。 假设您为16位数据指定n = 2。 然后,这将基本上将直方图分割为[0-2 ^ 15,2 ^ 15-2 ^ 16-1]。 第三种情况是您为每个bin指定映射。 即你必须指定每个bin的像素值范围。 http: ... -
一个C99的实现可能会提供uint64_t (如果没有固定宽度的整数,正好是64位,则不需要提供它),在这种情况下,可以使用: #include
unsigned char data[6] = { /* bytes from somewhere */ }; uint64_t result = ((uint64_t)data[0] << 40) | ((uint64_t)data[1] << 32) | ((uin ... -
您感兴趣的操作称为线性对比拉伸 。 基本上,您想要将每个强度乘以某个增益,然后将强度移动一些数字,以便操纵直方图的动态范围。 这与histeq或者使用图像的概率密度函数(直方图均衡的先驱)来增强图像。 直方图均衡寻求将图像直方图变平,以便在图像中遇到的强度或多或少是等概率的。 如果你想对这个主题有更权威的解释,请看我关于直方图均衡化如何工作的答案: MATLAB中直方图均衡化功能的说明 无论如何,选择a和b的值是高度依赖于图像的。 然而,我可以建议,如果你想这是适应性的一件事是使用最小最大规范化 。 基本上 ...
-
在计算直方图方面,每个强度的频率计算是正确的,尽管稍后会出现一些小错误。 另外,我会亲自避免在这里使用循环。 在这篇文章末尾看到我的小记。 不过,你的代码有三个问题: 问题#1 - 柱状图未正确初始化 histogram_values应该包含您的直方图,但您正在通过0:255的矢量初始化直方图。 每个强度值应以0开始计数 ,因此您实际上需要这样做: histogram_values = zeros(256,1); 问题#2 - for循环中的轻微错误 你的强度范围从0到255,但是MATLAB开始索引为1 ...
-
(对不起,我原来误读了要求认为是INPUT数据需要6个字节的要求。) 我不认为你可以用标准的密码算法来完成你想要的任务: 流密码的问题在于,标准密钥通过从密钥生成伪随机比特流,然后将这些比特与明文进行异或运算而有效地工作; 有效地,这意味着你不应该使用相同的比特流两次(例如,如果你这样做,那么对两个密文进行异或运算会得到与异或对应的明文异或的结果;在任何情况下,都有48比特,只有2 ^ 48个可能比特流,所以你可以用蛮力测试它们); 分块密码的问题在于没有标准密码,只要我知道块大小为48位。 现在,这并不意 ...
-
询问制造商有关生成此编号的任何模式。 这些24位中的一些很可能识别出生产批次或世界上要运送的部分,这使得它们成为被削减的主要候选者。 在请求中明确表示您已了解并接受他们可以随时更改编号策略,恕不另行通知。 这应该使他们更有可能提供信息。 Ask the manufacturer about any patterns in the generation of this number. It's quite likely that some of these 24 bits identify the produ ...
-
如何计算OPenCV中32位浮点图像的图像直方图(How to calculate image histogram of 32bit floating point image in OPenCV)[2022-06-19]
好吧,我已经做过很多次了。 像这样的东西: cv::Mat matSrc; // this is a CV_32FC1 normalised image int nHistSize = 65536; float fRange[] = { 0.0f, 1.0f }; const float* fHistRange = { fRange }; cv::Mat matHist; cv::calcHist(&matSrc, 1, 0, cv::Mat(), matHist, 1, &nHistSize, ...