Hession 异常 com.caucho.hessian.io.HessianProtocolException

今天在写一个简单的Hession小demo程序时,接口访问在服务层完全没有问题,但是通过另外一个模拟客户端程序去调用此服务时总是报com.caucho.hessian.io.HessianProtocolException: uploadFile: expected string at 0xff (?) 错误,在网上查了好多有说是客户端Hession版本与服务端版本不一致,Hession版本过高的都试过了,总是不行。也有说是因为Hession远程不支持方法重载,但是我程序就没有其他同名方法。最后我尝试各种方法,在我把参数位置对调后。程序成功执行了。具体原因目前也不清楚,先记录下。也许就是这不支持重载导致的。


后知原来

hessian要求inputstream 参数只能是参数列表中的最后一个

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Steger算法是一种基于边缘检测的算法,可以用于检测图像中的线条或边缘。在激光光条中心提取方面,可以将激光光条看作是一条边缘,然后使用Steger算法来提取其中心。 具体实现步骤如下: 1. 首先,读取激光光条的图像,并将其转换为灰度图像。 2. 利用Hessian矩阵计算图像中所有像素点的边缘响应值。 3. 对于每个像素点,计算其对应的边缘方向。 4. 对于每个像素点,找到其在边缘方向上的最大响应值,并将该响应值作为该像素点的权值。 5. 对于每个像素点,计算其在边缘方向上的加权平均值,并将该值作为该像素点所属的激光光条中心的位置。 6. 对于所有激光光条中心位置,进行滤波以消除噪声。 7. 最终,得到激光光条的中心位置信息。 下面是一个基于Python的Steger算法的实现示例: ```python import cv2 import numpy as np def calculate_edge_response(img): # 计算Hessian矩阵 Hxx = cv2.Sobel(img, cv2.CV_64F, 2, 0, ksize=3) Hyy = cv2.Sobel(img, cv2.CV_64F, 0, 2, ksize=3) Hxy = cv2.Sobel(img, cv2.CV_64F, 1, 1, ksize=3) Hessian = np.zeros_like(img, dtype=np.float64) for i in range(img.shape[0]): for j in range(img.shape[1]): H = np.array([[Hxx[i,j], Hxy[i,j]], [Hxy[i,j], Hyy[i,j]]]) Hessian[i,j] = np.linalg.det(H) - 0.04 * np.trace(H) ** 2 # 对Hessian矩阵进行非极大值抑制 edge_response = np.zeros_like(img, dtype=np.float64) for i in range(1, img.shape[0]-1): for j in range(1, img.shape[1]-1): if Hessian[i,j] > 0 and \ Hessian[i,j] > Hessian[i-1,j-1] and \ Hessian[i,j] > Hessian[i-1,j] and \ Hessian[i,j] > Hessian[i-1,j+1] and \ Hessian[i,j] > Hessian[i,j-1] and \ Hessian[i,j] > Hessian[i,j+1] and \ Hessian[i,j] > Hessian[i+1,j-1] and \ Hessian[i,j] > Hessian[i+1,j] and \ Hessian[i,j] > Hessian[i+1,j+1]: edge_response[i,j] = Hessian[i,j] return edge_response def calculate_edge_direction(img): # 计算边缘方向 dx = cv2.Sobel(img, cv2.CV_64F, 1, 0, ksize=3) dy = cv2.Sobel(img, cv2.CV_64F, 0, 1, ksize=3) angle = np.arctan2(dy, dx) angle[angle < 0] += np.pi return angle def calculate_center(img, angle): # 计算每个像素点在边缘方向上的权值 weight = img * np.cos(angle) ** 2 # 计算每个像素点所属的激光光条中心的位置 center = np.zeros_like(img, dtype=np.float64) for i in range(1, img.shape[0]-1): for j in range(1, img.shape[1]-1): if weight[i,j] > 0: x = int(np.round(i + weight[i,j] * np.sin(angle[i,j]))) y = int(np.round(j + weight[i,j] * np.cos(angle[i,j]))) if x >= 0 and x < img.shape[0] and y >= 0 and y < img.shape[1]: center[x,y] += 1 return center def filter_center(center): # 对激光光条中心位置进行滤波 kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (5, 5)) center = cv2.erode(center, kernel) center = cv2.dilate(center, kernel) return center if __name__ == '__main__': # 读取激光光条图像 img = cv2.imread('laser.png', cv2.IMREAD_GRAYSCALE) # 计算边缘响应值和边缘方向 edge_response = calculate_edge_response(img) angle = calculate_edge_direction(edge_response) # 计算激光光条中心位置 center = calculate_center(edge_response, angle) # 进行滤波 center = filter_center(center) # 显示结果 cv2.imshow('Laser Center', center) cv2.waitKey(0) cv2.destroyAllWindows() ``` 其中,`calculate_edge_response`函数用于计算Hessian矩阵,并对其进行非极大值抑制,得到边缘响应值;`calculate_edge_direction`函数用于计算边缘方向;`calculate_center`函数用于计算每个像素点在边缘方向上的权值,并将该像素点所属的激光光条中心的位置累加到相应的位置;`filter_center`函数用于对激光光条中心位置进行滤波。最终,得到的`center`即为激光光条的中心位置信息。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值