MongoDB - 图像的REST API体系结构(MongoDB - REST API Architecture For Images)
我在MONGODB的RAW BINARY DATA中有成千上万的图像(尺寸小于16MB),其JSON元数据来自小卫星(BSON文档)的日期,时间,位置等。 我必须制作REST API,它可以用各自的元数据查询图像。 以下事项需要在观察下进行。
数据= 数据截图
- 用户将根据时间,地点等,使用RestAPI查询元数据。
- 服务器将通过查询和DO图像处理从“无提示”中获取请求并返回图像
- 图像处理将在服务器端完成。
- 请求的图像将通过GET请求通过RESTAPI从服务器传输到客户端。
注意:请看附加图片以获取数据的想法。
使用的工具:数据库= MongoDB
问题
- 哪种服务器端编程语言更可行? PHP,Python或Node.js?
- 我在这种情况下如何做图像处理? 使用PHP,Python或Node.js上的库?
- 使用哪种技术为MongoDB制作最适合二进制数据和图像的REST API。
- 图像如何从服务器传输到客户端,即在二进制数据中。 然后在客户端呈现。
I have thousands of Images (wihch are less then 16MB in size) in RAW BINARY DATA in MONGODB with its Meta-Data in JSON as Date, Time, Location etc from the Small Satellite (BSON Documents). I have to make REST API which can query the Images with its respective Meta-Data. Following things needs to be taken under observation.
Data = Data Screenshot
- User's will query the Meta-Data with RestAPI, based on time, location etc.
- Server will get the Request from Cilent with Query and DO Image-Processing and Returns the Images
- Image Processing will be done on Server Side.
- Requested Images will travel through RESTAPI from Server to Client with the GET Request.
NOTE : Just see the Attached Picture to Get the Idea of the DATA.
Tools Used : Data-Base = MongoDB
Questions
- Which Server Side Programming Language is More feasible? PHP, Python or Node.js?
- How I could do Image-Processing in this scenario? With Libraries on PHP, Python or Node.js?
- Which Technology to be Used for making REST API for MongoDB which is best with Binary Data and Images.
- How Images will travel from Server to client i-e In binary data. and then Renders at Client Side.
原文:https://stackoverflow.com/questions/41244990
满意答案
编辑:其实,我不再确定。 几个版本后来,似乎GLFW不再适用于OS X上的GHCi。
事实证明,GLFW + OpenGL满足所有四个要求!
- 你需要用
ghci -framework Carbon
调用ghci。- 你需要
EnableGUI.hs
文件,你可以在这里获得。 请注意,您无法将其加载到GHCi中,您必须首先将其加密。- OpenGL有一个2D投影模式,可以绘制线条和多边形。
- 位图可以作为纹理加载并放在多边形上。
这是一个小例子,它将一个位图放到屏幕上。 对位图有一些限制:它的尺寸必须是2的幂(这里是256),它必须是一个
.tga
文件(这里是"Bitmap.tga"
)。 但是既然支持透明度,这不是什么大问题。你应该可以多次呼叫
main
问题。 关键是你不应该调用GLFW.terminate
。import Graphics.Rendering.OpenGL as GL import qualified Graphics.UI.GLFW as GLFW import Graphics.Rendering.OpenGL (($=)) import Control.Monad import EnableGUI main = do enableGUI GLFW.initialize -- open window GLFW.openWindow (GL.Size 400 400) [GLFW.DisplayAlphaBits 8] GLFW.Window GLFW.windowTitle $= "Bitmap Test" -- enable alpha channel GL.blend $= GL.Enabled GL.blendFunc $= (GL.SrcAlpha, GL.OneMinusSrcAlpha) -- set the color to clear background GL.clearColor $= GL.Color4 0.8 0.8 0.8 0 -- set 2D orthogonal view inside windowSizeCallback because -- any change to the Window size should result in different -- OpenGL Viewport. GLFW.windowSizeCallback $= \ size@(GL.Size w h) -> do GL.viewport $= (GL.Position 0 0, size) GL.matrixMode $= GL.Projection GL.loadIdentity GL.ortho2D 0 (realToFrac w) (realToFrac h) 0 render <- initialize loop render GLFW.closeWindow loop render = do -- draw the entire screen render -- swap buffer GLFW.swapBuffers -- check whether ESC is pressed for termination p <- GLFW.getKey GLFW.ESC unless (p == GLFW.Press) $ do -- sleep for 1ms to yield CPU to other applications GLFW.sleep 0.001 -- only continue when the window is not closed windowOpenStatus <- GLFW.getParam GLFW.Opened unless (windowOpenStatus == False) $ loop render -- rendering initialize = do -- load texture from file GL.texture GL.Texture2D $= Enabled [textureName] <- GL.genObjectNames 1 GL.textureBinding GL.Texture2D $= Just textureName GL.textureFilter GL.Texture2D $= ((GL.Nearest, Nothing), GL.Nearest) GLFW.loadTexture2D "Bitmap.tga" [] return $ do GL.clear [GL.ColorBuffer] GL.renderPrimitive GL.Quads $ do GL.texCoord $ texCoord2 0 0 GL.vertex $ vertex3 (0) 256 0 GL.texCoord $ texCoord2 0 1 GL.vertex $ vertex3 (0) (0) 0 GL.texCoord $ texCoord2 1 1 GL.vertex $ vertex3 256 (0) 0 GL.texCoord $ texCoord2 1 0 GL.vertex $ vertex3 256 256 0 -- type signatures to avoid ambiguity vertex3 :: GLfloat -> GLfloat -> GLfloat -> GL.Vertex3 GLfloat vertex3 = GL.Vertex3 texCoord2 :: GLfloat -> GLfloat -> GL.TexCoord2 GLfloat texCoord2 = GL.TexCoord2 color3 :: GLfloat -> GLfloat -> GLfloat -> GL.Color3 GLfloat color3 = GL.Color3
这里有一个示例位图(您需要将其转换为
.tga
)。EDIT: Actually, I'm no longer sure. Several versions later, it seems that GLFW no longer works in GHCi on OS X.
It turns out that GLFW+OpenGL fulfills all four requirements!
- You need to invoke ghci with
ghci -framework Carbon
.- You need the
EnableGUI.hs
file, which you can get here. Note that you can't load it right into GHCi, you have to comiple it, first.- OpenGL has a 2D projection mode where you can draw lines and polygons.
- Bitmaps can be loaded as textures and put on polygons.
Here is a small example that puts a bitmap onto the screen. There are some restrictions on the bitmap: its dimensions must be a power of two (here 256) and it must be a
.tga
file (here"Bitmap.tga"
). But since transparency is supported, this is not much of a problem.You should be able to call
main
multiple times without problem. The key point is that you should not callGLFW.terminate
.import Graphics.Rendering.OpenGL as GL import qualified Graphics.UI.GLFW as GLFW import Graphics.Rendering.OpenGL (($=)) import Control.Monad import EnableGUI main = do enableGUI GLFW.initialize -- open window GLFW.openWindow (GL.Size 400 400) [GLFW.DisplayAlphaBits 8] GLFW.Window GLFW.windowTitle $= "Bitmap Test" -- enable alpha channel GL.blend $= GL.Enabled GL.blendFunc $= (GL.SrcAlpha, GL.OneMinusSrcAlpha) -- set the color to clear background GL.clearColor $= GL.Color4 0.8 0.8 0.8 0 -- set 2D orthogonal view inside windowSizeCallback because -- any change to the Window size should result in different -- OpenGL Viewport. GLFW.windowSizeCallback $= \ size@(GL.Size w h) -> do GL.viewport $= (GL.Position 0 0, size) GL.matrixMode $= GL.Projection GL.loadIdentity GL.ortho2D 0 (realToFrac w) (realToFrac h) 0 render <- initialize loop render GLFW.closeWindow loop render = do -- draw the entire screen render -- swap buffer GLFW.swapBuffers -- check whether ESC is pressed for termination p <- GLFW.getKey GLFW.ESC unless (p == GLFW.Press) $ do -- sleep for 1ms to yield CPU to other applications GLFW.sleep 0.001 -- only continue when the window is not closed windowOpenStatus <- GLFW.getParam GLFW.Opened unless (windowOpenStatus == False) $ loop render -- rendering initialize = do -- load texture from file GL.texture GL.Texture2D $= Enabled [textureName] <- GL.genObjectNames 1 GL.textureBinding GL.Texture2D $= Just textureName GL.textureFilter GL.Texture2D $= ((GL.Nearest, Nothing), GL.Nearest) GLFW.loadTexture2D "Bitmap.tga" [] return $ do GL.clear [GL.ColorBuffer] GL.renderPrimitive GL.Quads $ do GL.texCoord $ texCoord2 0 0 GL.vertex $ vertex3 (0) 256 0 GL.texCoord $ texCoord2 0 1 GL.vertex $ vertex3 (0) (0) 0 GL.texCoord $ texCoord2 1 1 GL.vertex $ vertex3 256 (0) 0 GL.texCoord $ texCoord2 1 0 GL.vertex $ vertex3 256 256 0 -- type signatures to avoid ambiguity vertex3 :: GLfloat -> GLfloat -> GLfloat -> GL.Vertex3 GLfloat vertex3 = GL.Vertex3 texCoord2 :: GLfloat -> GLfloat -> GL.TexCoord2 GLfloat texCoord2 = GL.TexCoord2 color3 :: GLfloat -> GLfloat -> GLfloat -> GL.Color3 GLfloat color3 = GL.Color3
Here an example bitmap (which you need to convert to
.tga
).
相关问答
更多Haskell图形库在MacOS X上的GHCi中工作(Haskell Graphics Library that works in GHCi on MacOS X)
ghci:Emacs haskell-mode中的自定义提示(ghci: Custom Prompt in Emacs haskell-mode)
尽管stack ghci工作,但由于缺少包,堆栈构建失败(Stack build fails due to missing package although stack ghci works)
Haskell / GHCI中的别名(Aliases in Haskell/GHCI)
是否有支持内联图形显示的ghci GUI前端/扩展,如ipython?(Is there any ghci GUI frontend/extension that support inline graphics display like ipython? [closed])
Windows中使用GHCI的Haskell外部函数接口(Haskell Foreign Function Interface with GHCI in Windows)
Haskell,限制GHCI内存(Haskell, Limit GHCI memory)
在GHCi中工作>但不是在加载时?(Works in GHCi> but not when loaded?)
Haskell GHCi - 使用getContents在stdin上使用EOF字符(Haskell GHCi - Using EOF character on stdin with getContents)
Haskell在`ghci`中多行`let`(Haskell multi-line `let` in `ghci`)
相关文章
更多快速了解MongoDB【基本概念与体系结构】
Stack Overflow Architecture Update - Now At 95 Million Page Views A Month
MongoDB的体系结构_深入浅出MongoDB(三)
Hibernate架构体系结构
传说中的WeixinJSBridge和微信rest接口
LVS体系结构
MongoDB集成Hadoop进行统计计算
Solr Architecture[转]
《Apache源代码全景分析-第1卷:体系结构与核心模块》扫描版[PDF]
对比下HBase, Memcached, MongoDB, Redis和Solr
最新问答
更多获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
如何通过引用返回对象?(How is returning an object by reference possible?)
矩阵如何存储在内存中?(How are matrices stored in memory?)
每个请求的Java新会话?(Java New Session For Each Request?)
css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
xcode语法颜色编码解释?(xcode syntax color coding explained?)
在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
Copyright ©2023 peixunduo.com All Rights Reserved.粤ICP备14003112号
本站部分内容来源于互联网,仅供学习和参考使用,请莫用于商业用途。如有侵犯你的版权,请联系我们(neng862121861#163.com),本站将尽快处理。谢谢合作!